|
mesagebox创建方法:
/*********************************************************************
*
* _MessageBox
*
* Function description
* Creates and executes a modal message box
*/
static void _MessageBox(const char * pText, const char * pCaption) {
WM_HWIN hBox;
WM_HWIN hItem;
hBox = MESSAGEBOX_Create(pText, pCaption, 0);
WM_SetWindowPos(hBox,0,40,160,80);
FRAMEWIN_SetSkinClassic(hBox);
FRAMEWIN_SetClientColor(hBox,GUI_BLACK);
FRAMEWIN_SetFont(hBox,&ST12_Font);
FRAMEWIN_SetTextColor(hBox,GUI_WHITE);
hItem = WM_GetDialogItem(hBox,GUI_ID_TEXT0);
WM_SetWindowPos(hItem, 2, 65,156,20);
TEXT_SetBkColor(hItem,GUI_BLACK);
TEXT_SetTextColor(hItem,GUI_WHITE);
TEXT_SetFont(hItem,&ST12_Font);
TEXT_SetTextAlign(hItem,TEXT_CF_HCENTER|TEXT_CF_VCENTER);
hItem = WM_GetDialogItem(hBox,GUI_ID_OK);
BUTTON_SetFont(hItem,&ST12_Font);
BUTTON_SetText(hItem," 返 回 ");
WM_SetWindowPos(hItem, 45, 86,70,25);
WM_SetFocus(hItem);
GUI_ExecCreatedDialog(hBox);
WM_SetFocus(_hMenu);
MENU_SetSel(_hMenu, -1);
}
调用:
/*********************************************************************桌面回调函数
*
* _cbdesktop
*
* Function description
* Callback routine of client window which 'owns' the menu widget
* and the status bar
*/
static void _cbdesktop(WM_MESSAGE * pMsg) {
int Index;
MENU_MSG_DATA * pData;
switch (pMsg->MsgId)
{
case WM_PAINT:
_paint();
break;
case WM_MENU:
pData = (MENU_MSG_DATA*)pMsg->Data.p;
switch (pData->MsgType)
{
case MENU_ON_ITEMACTIVATE:
//
// This message is send on highlighting a menu item
break;
case MENU_ON_ITEMPRESSED:
item_id = pData->ItemId;
switch(item_id)
{
case ID_MENU_MANGE_113: {
_MessageBox("消息内容...","提示");
break;}
}
break;
default:
WM_DefaultProc(pMsg);
}
default:
WM_DefaultProc(pMsg);
}
}
现在的问题是:执行菜单命令是调用了消息对话框,然后就没有按键反映了。按键任务函数再也进不去了。
按键任务函数:
/*----------------------------------------------------------------------------
***************************按键检测******************************************
*---------------------------------------------------------------------------*/
void key_thread (void const *argument)
{
static uint8_t n,pin_state[6];
for (;;)
{
for(n=0;n<KEY_COUNT;n++)
{
if(GPIO_PinRead(KEY_PIN[n].Portnum,KEY_PIN[n].Pinnum) == 0)
{
if(pin_state[n] == 1)
{
GUI_Delay(10);
if(GPIO_PinRead(KEY_PIN[n].Portnum,KEY_PIN[n].Pinnum) == 0)
{
switch(n)
{
case 0: GUI_SendKeyMsg(GUI_KEY_UP,1); break;
case 1: GUI_SendKeyMsg(GUI_KEY_DOWN,1); break;
case 2: GUI_SendKeyMsg(GUI_KEY_RIGHT,1); break;
case 3: GUI_SendKeyMsg(GUI_KEY_LEFT,1); break;
case 4: GUI_SendKeyMsg(GUI_KEY_ENTER,1); break;
case 5: GUI_SendKeyMsg(GUI_KEY_ESCAPE,1); break;
}
}
}
pin_state[n] = 0;
}
else pin_state[n] = 1;
}
GUI_Delay(100);
}
}
请求各位帮忙,多谢!
|
|