@2018-7-11
【小记】
emWin 通过函数 WM_SetCallback ( ) 自定义回调函数
> 下段代码就是通过 MESSAGEBOX 控件的 OK 按键实现删除信息框的对话框,即消息框的背景窗口 DIALOG 删除了,留下了 TEXT & BUTTON
hWin = MESSAGEBOX_Create("这是一个帮助!\n你觉得这个帮助功能如何?", "帮助", 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;
}
}