中断的代码片段:
[mw_shl_code=c,true]GPIO_ResetBits(KEYBOARD_ROW_PORT, KEYBOARD_ROW_BASE << i);
if(!GPIO_ReadInputDataBit(KEYBOARD_COL_PORT, KEYBOARD_COL_2))
{
g_key_param.msg.col = KEYBOARD_COL_2;
g_key_param.msg.code = GUI_KEY_DOWN;
OSMboxPost(g_key_param.mbox, (void *)&g_key_param.msg);
break;
}[/mw_shl_code]
回调函数代码:
[mw_shl_code=c,true]static void cbSubMenuDialog(WM_MESSAGE* pMsg)
{
WM_HWIN hWin;
BUTTON_Handle hButton;
hWin=pMsg->hWin;
switch(pMsg->MsgId)
{
case WM_INIT_DIALOG:
GUI_SetFont(&GUI_Font8x16);
GUI_SetBkColor(GUI_BLUE);
hButton = WM_GetDialogItem(hWin, GUI_ID_BUTTON1);
WM_SetFocus(hButton); //聚焦第二个button
break;
case WM_KEY:
switch(((WM_KEY_INFO*)(pMsg->Data.p))->Key)
{
case GUI_KEY_DOWN:
hButton = WM_GetDialogItem(hWin, GUI_ID_BUTTON2);
WM_SetFocus(hButton);
break;
default:
break;
}
default:
WM_DefaultProc(pMsg);
}
}[/mw_shl_code]
问题出在哪里?
[mw_shl_code=c,true]void SubMenu(void)
{
GUI_ExecDialogBox(SubMenuDialog,
GUI_COUNTOF(SubMenuDialog),
&cbSubMenuDialog, 0 , 0 , 0 );
}[/mw_shl_code]
假如我的主函数是用阻塞方式建立的对话框,我想在主函数里聚焦到其他的button,我该如何实现,因为我发现,不管我把 WM_SetFocus放到哪里,都不会聚焦到相应的button,该如何处理呢?
|