emwin之在WM_INIT_DIALOG分支下使用带触发功能的函数的程序框架

@2018-08-29

【小记】

为避免在窗口创建时由于使用了带触发功能的函数导致执行一些在初始化过程中不允许的操作,特整理一个流程架构

--①  定义一个初始化完成的标志

unsigned char initComplete = ;

--②  回调函数

  >在初始化完毕后将完成标志置位,

  >在待触发位置 ‘&&’ 完成标志,以避免初始化过程中执行被触发的动作

  >在‘OK’或‘NO’按下退出时清除完成标志

 static void _cbDialog(WM_MESSAGE * pMsg)
{
switch (pMsg->MsgId)
{
case WM_INIT_DIALOG:
hItem = WM_GetDialogItem(pMsg->hWin, ID_DROPDOWN_0);
DROPDOWN_SetSel(hItem, );
... initComplete = 1;
break; case WM_NOTIFY_PARENT:
switch(Id)
{
case ID_DROPDOWN_0: // Notifications sent by 'Local/Remote/timeTable'
switch(NCode)
{
case WM_NOTIFICATION_CLICKED:
// USER START (Optionally insert code for reacting on notification message)
// USER END
break;
case WM_NOTIFICATION_RELEASED:
// USER START (Optionally insert code for reacting on notification message)
// USER END
break;
case WM_NOTIFICATION_SEL_CHANGED:
// USER START (Optionally insert code for reacting on notification message) hItem = WM_GetDialogItem(pMsg->hWin, ID_DROPDOWN_0); if(( == DROPDOWN_GetSel(hItem)) && initComplete)
{
CreatetimeTableFramewin();
}
}
// USER END
break; case ID_BUTTON_1: // Notifications sent by 'OK'
switch(NCode)
{
case WM_NOTIFICATION_CLICKED:
// USER START (Optionally insert code for reacting on notification message)
// USER END
break;
case WM_NOTIFICATION_RELEASED:
// USER START (Optionally insert code for reacting on notification message) initComplete = 0; // USER END
break;
// USER START (Optionally insert additional code for further notification handling)
// USER END
}
break; case ID_BUTTON_2: // Notifications sent by 'Cancel'
switch(NCode)
{
case WM_NOTIFICATION_CLICKED:
// USER START (Optionally insert code for reacting on notification message)
// USER END
break;
case WM_NOTIFICATION_RELEASED:
// USER START (Optionally insert code for reacting on notification message) initComplete = 0; // USER END
break;
// USER START (Optionally insert additional code for further notification handling)
// USER END
}
break;
break;
}
上一篇:iOS_SN_Xcode内存泄露调试


下一篇:手动添加 launcher 到 Ubuntu Unity