|
最近做了一下uCOSIII和uCGUI3.98移植。显示没什么问题,uCGUI的demo也能跑,然后自己写了个对话框,对话框有若干按钮,在显示器上按button,button有反应但是不会执行代码,调试发现在
Id = WM_GetId(pMsg->hWinSrc);
NCode = pMsg->Data.v;
switch(NCode)
{
case WM_NOTIFICATION_RELEASED:
case GUI_ID_OK:
EDIT_AddKey(WM_GetDialogItem(hWin,GUI_ID_EDIT0),'\0');
EDIT_GetText(WM_GetDialogItem(hWin,GUI_ID_EDIT0),numb,9);
GUI_MessageBox("ress Right Number","Warning!!",0);
break;
case GUI_ID_CANCEL:
GUI_EndDialog(hWin, 0);
break;
NCode 的值开始为1(WM_NOTIFICATION_CLICKED),后来为WM_NOTIFICATION_MOVED_OUT(3),一直不是想要的WM_NOTIFICATION_RELEASED,故程序没有运行。请问大家有没有遇到过这样的情况?一般这样的情况,问题会出现在哪里?
static void _OnTouch(BUTTON_Handle hObj, BUTTON_Obj* pObj, WM_MESSAGE*pMsg) {
const GUI_PID_STATE* pState = (const GUI_PID_STATE*)pMsg->Data.p;
#if BUTTON_REACT_ON_LEVEL
if (!pMsg->Data.p) { /* Mouse moved out */
_OnButtonReleased(hObj, pObj, WM_NOTIFICATION_MOVED_OUT);
} else if ((!pState->ressed) && (pObj->Widget.State & BUTTON_STATE_PRESSED)) {
_OnButtonReleased(hObj, pObj, WM_NOTIFICATION_MOVED_OUT);
}
#else
if (pMsg->Data.p) { /* Something happened in our area (pressed or released) */
if (pState->ressed) {
if ((pObj->Widget.State & BUTTON_STATE_PRESSED) == 0){
_OnButtonPressed(hObj, pObj);
}
} else {
/* React only if button was pressed before ... avoid problems with moving / hiding windows above (such as dropdown) */
if (pObj->Widget.State & BUTTON_STATE_PRESSED) {
_OnButtonReleased(hObj, pObj, WM_NOTIFICATION_RELEASED);
}
}
} else {
_OnButtonReleased(hObj, pObj, WM_NOTIFICATION_MOVED_OUT);
}
#endif
}
pObj->Widget.State这个值在消息反馈时候好像出了问题。不知道有没有朋友可以给点提示,如有必要我可以发我LCD和触摸驱动上来,大家一起找找原因。 |
|