2019-12-19 18:13发布
dalarang 发表于 2014-5-21 21:08 GUI_StoreKeyMsg(GUI_KEY_ENTER, 1); 很简单明了,LZ自由发挥想象力具体怎么用
最多设置5个标签!
很简单明了,LZ自由发挥想象力具体怎么用
哦,是外部来扫描啊,我还在琢磨怎么和触屏不一样。马上试试!
没有触发回调函数,还差点什么?
- hWin = GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbDialog, WM_HBKWIN, 0, 0);
复制代码- static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] =
- {
- { FRAMEWIN_CreateIndirect, "Edit winmode", 0, 90, 90, 140, 130, FRAMEWIN_CF_MOVEABLE},
- { EDIT_CreateIndirect, NULL, GUI_ID_EDIT0, 10, 10, 110, 20, 0, 15},
- { EDIT_CreateIndirect, NULL, GUI_ID_EDIT1, 10, 40, 110, 20, 0, 15},
- { BUTTON_CreateIndirect, "Ok", GUI_ID_OK, 10, 80, 50, 20 },
- { BUTTON_CreateIndirect, "Cancel", GUI_ID_CANCEL, 70, 80, 50, 20 },
- };
复制代码回调函数:
- static void _cbDialog(WM_MESSAGE * pMsg)
- {
- int i;
- int NCode;
- int Id;
- WM_HWIN hDlg;
- WM_HWIN hItem;
- hDlg = pMsg->hWin;
- switch (pMsg->MsgId)
- {
- case WM_INIT_DIALOG:
- FRAMEWIN_SetFont(pMsg->hWin, &GUI_Font13_ASCII);
- FRAMEWIN_SetTextAlign(pMsg->hWin, GUI_TA_HCENTER);
- for (i = 0; i < 2; i++)
- {
- hItem = WM_GetDialogItem(hDlg, GUI_ID_EDIT0 + i); // Get the handle of the edit widget
- EDIT_AddKey(hItem, GUI_KEY_ADD);
- EDIT_SetText(hItem, "Hello world!"); // Fill widget with text
- EDIT_SetSel(hItem, 0, -1); // Select the whole contents of the edit field
- }
- break;
- case WM_KEY:
- switch (((WM_KEY_INFO*)(pMsg->Data.p))->Key)
- {
- case GUI_KEY_ESCAPE:
- GUI_EndDialog(hDlg, 1);
- break;
-
- case GUI_KEY_ENTER:
- GUI_EndDialog(hDlg, 0);
- break;
- }
- break;
- case WM_NOTIFY_PARENT:
- Id = WM_GetId(pMsg->hWinSrc); // Id of widget
- NCode = pMsg->Data.v; // Notification code
- switch (NCode)
- {
- case WM_NOTIFICATION_RELEASED: // React only if released
- if (Id == GUI_ID_OK)
- { // OK Button
- GUI_EndDialog(hDlg, 0);
- }
- if (Id == GUI_ID_CANCEL)
- { // Cancel Button
- GUI_EndDialog(hDlg, 1);
- }
-
- break;
- }
- break;
- default:
- WM_DefaultProc(pMsg);
- }
- }
复制代码任务循环代码:
- GUI_Delay(10);
复制代码按键发送:
- GUI_SendKeyMsg(GUI_KEY_ESCAPE, 1);
复制代码补充描述:
发送按键,没有触发回调函数:WM_KEY。
一周热门 更多>