|
C:\Users\Administrator\Desktop\QQ截图20141009201419.jpg
不用触摸使用外部按键实现下拉菜单,通过上下按键选择submenu中的item
添加项目子函数:
void _AddMenuItem(MENU_Handle hMenu, MENU_Handle hSubmenu, char* pText, U16 Id, U16 Flags) {
MENU_ITEM_DATA Item;
Item.pText = pText;
Item.hSubmenu = hSubmenu;
Item.Flags = Flags;
Item.Id = Id;
MENU_AddItem(hMenu, &Item);
}
创建一个submenu,添加了几个item
file=MENU_CreateEx(0,40,0,0,0,WM_CF_ACTIVATE,MENU_CF_VERTICAL,0x801);
MENU_SetFont(hMenu,&GUI_Font8x10_ASCII);
_AddMenuItem(file,0,"setA",0x802,0);
_AddMenuItem(file,0,"setB",0x803,0);
_AddMenuItem(file,0,"setC",0x804,0);
_AddMenuItem(file,0,0,0,MENU_IF_SEPARATOR);
_AddMenuItem(file,0,"Exit",0x805,0);
主菜单:
hMenu=MENU_CreateEx(0,0,800,40,0,WM_CF_SHOW,MENU_CF_HORIZONTAL,0x880);
_AddMenuItem(hMenu,file,"FILE",0x881,0);
然后在按键扫描函数里添加,当按键按下的时候执行:
WM_SetFocus(file);
GUI_StoreKeyMsg(GUI_KEY_DOWN,1);
可是没有任何效果啊!!!gui有个hardkey例程就是这样操作list控件的啊,换成menu控件就不行了 我改成使用GUI_SendKeyMsg(GUI_KEY_DOWN,1);也不行啊 求大神帮忙看看啊 折腾好几天了
|
|