在没有操作系统或者窗口的情况下如果知道我按下了某个button。
我用如下方式不怎么会,老出现问题。本来我用的定时器扫描触摸,没用这些之前能让光标跟着触摸走,用了这些后定时器都不工作了
void _cbTransWindow(WM_MESSAGE* pMsg)
{
WM_HWIN hWin = pMsg->hWin;
GUI_PID_STATE State;
GUI_PID_GetState(&State);
switch (pMsg->MsgId) //调试能到这里,但是5、6次过后就跳到HardFault_Handler里面去了
{
case WM_PAINT:
GUI_TOUCH_Exec(); //这里做测试用
GUI_Exec();
break;
case WM_TOUCH:
if (pMsg->Data.p)
{
GUI_PID_STATE* pState = (GUI_PID_STATE*)pMsg->Data.p;
if (pState-> ressed)
{
}
}
break;
case WM_NOTIFY_PARENT:
switch(pMsg->Data.v)
{
case WM_NOTIFICATION_RELEASED:
if(pMsg->hWinSrc == 1)
{
//GUI_MessageBox(" i love you","Caption/Title",GUI_MESSAGEBOX_CF_MOVEABLE);
GUI_DispStringAt("clicked",70,90);
}
break;
}
break;
default:
WM_DefaultProc(pMsg);
}
}
static void _DemoTransWindow(void)
{
WM_HWIN hTransWin;
BUTTON_Handle hBut;
//WM_SetCreateFlags(WM_CF_MEMDEV); //这里两行我注释掉了,因为我想的是guiconf里面的GUI_SUPPORT_MEMDEV我没打开,不知道
//WM_EnableMemdev(WM_HBKWIN); //我想得对不对
WM_SetDesktopColor(GUI_RED);
hTransWin = WM_CreateWindow(80, 100, 120, 200, WM_CF_SHOW | WM_CF_HASTRANS | WM_CF_STAYONTOP,
&_cbTransWindow, 0);
hBut = BUTTON_CreateAsChild(100,20,100,20,hTransWin,1,WM_CF_SHOW);
BUTTON_SetText(hBut,"ok");
while (1)
{
WM_InvalidateWindow(hTransWin); //这里只执行了一次,后来一直执行 上面的消息循环了
GUI_Delay(20);
}
} |