emWin通过函数WM_SetCallback()
自定义回调函数
下段代码就是通过 MESSAGEBOX 控件的 OK 按键实现删除信息框的对话框,即消息框的背景窗口 DIALOG 删除了,留下了 TEXT & BUTTON
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
hWin = MESSAGEBOX_Create("这是一个测试", "测试标题", GUI_MESSAGEBOX_CF_MOVEABLE);
WM_SetCallback(hWin, _cbDialogMessage);
static void _cbDialogMessage(WM_MESSAGE *pMsg)
{
WM_HWIN hWin;
int NCode;
int Id;
hWin = pMsg->hWin;
switch (pMsg->MsgId)
{
case WM_NOTIFY_PARENT:
Id = WM_GetId(pMsg->hWinSrc);
NCode = pMsg->Data.v;
switch (Id)
{
case GUI_ID_OK:
switch (NCode)
{
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
WM_DeleteWindow(hWin);
break;
}
break;
}
break;
default:
WM_DefaultProc(pMsg);
break;
}
}
|