Hello,
I've already used emWin (STemWin in particular) to create single layer dialogs without any problem.
Usually I create single .c files for each single GUI page (which consists of a main dialog) and to change from a page to another one I delete the previous one with GUI_EndDialog() in the following way:
Display All
I tried to do the same with a two layer dialog following the same principle:
Display All
This works for a while but gets stuck (memory fault) after some (variable number, not a repetitive number!) of page changes at the last WM_Exec() instruction.
Without the line:
it doesn't get stuck but obviously the old layer #1 stays on the screen (since it's visible).
There shouldn't be problems related to memory space since I'm using an external memory for the different buffer frame layers.
Could anybody suggest me a different working way to switch between these kind of dialogs or tell me what I'm doing wrong?
Thank you!
Regards,
Mark
I've already used emWin (STemWin in particular) to create single layer dialogs without any problem.
Usually I create single .c files for each single GUI page (which consists of a main dialog) and to change from a page to another one I delete the previous one with GUI_EndDialog() in the following way:
Source Code
- static WM_HWIN hWinMain, hWinAlarms;
- WM_HWIN hItem;
- //========================================================
- // Main page creation
- //========================================================
- hWinMain = GUI_CreateDialogBox(_aWinMainDialogCreate, GUI_COUNTOF(_aWinMainDialogCreate), _cbDialogWinMain, WM_GetDesktopWindowEx(0), 0, 0);
- ...
- //========================================================
- //Redrawing operations
- //========================================================
- ...
- WM_Exec();
- //========================================================
- //A page change is needed, prepare data (ID of the dialog window)
- //========================================================
- hItem = WM_GetDialogItem(hWinMain, IDGUIMAIN_WINDOW);
- WM_EnableWindow(hItem);
- //========================================================
- //Save current dialog which will become the previous one
- //========================================================
- // (g_GUI.hPrevDialog is declared as WM_HWIN type)
- g_GUI.hPrevDialog = hWinMain;
- WM_Exec();
- //========================================================
- //Next page is the alarms one, create it
- //========================================================
- hWinAlarms = GUI_CreateDialogBox(_aWinAlarmsDialogCreate, GUI_COUNTOF(_aWinAlarmsDialogCreate), _cbDialogWinAlarms, WM_GetDesktopWindowEx(0), 0, 0);
- //========================================================
- //End the previous dialog
- //========================================================
- GUI_EndDialog (g_GUI.hPrevDialog, 0);
- g_GUI.hPrevDialog = 0;
- WM_Exec();
I tried to do the same with a two layer dialog following the same principle:
Source Code
- static WM_HWIN hWinMain_Layer_0, hWinMain_Layer_1, hWinAlarms;
- WM_HWIN hItem;
- //========================================================
- // Main page creation, this time with two layers
- //========================================================
- hWinMain_Layer_0 = GUI_CreateDialogBox(_aWinMainDialogCreate_Layer_0, GUI_COUNTOF(_aWinMainDialogCreate_Layer_0), _cbDialogWinMain_Layer_0, WM_GetDesktopWindowEx(0), 0, 0);
- hWinMain_Layer_1 = GUI_CreateDialogBox(_aWinMainDialogCreate_Layer_1, GUI_COUNTOF(_aWinMainDialogCreate_Layer_1), _cbDialogWinMain_Layer_1, WM_GetDesktopWindowEx(1), 0, 0);
- ...
- //========================================================
- //Redrawing operations
- //========================================================
- ...
- WM_Exec();
- //========================================================
- //A page change is needed, prepare data
- //========================================================
- hItem = WM_GetDialogItem(hWinMain_Layer_0, IDGUIMAIN_WINDOW_LAYER_0);
- WM_EnableWindow(hItem);
- hItem = WM_GetDialogItem(hWinMain_Layer_1, IDGUIMAIN_WINDOW_LAYER_1);
- WM_EnableWindow(hItem);
- //========================================================
- //Save current dialogs which will become the previous ones
- //========================================================
- g_GUI.hPrevDialog_Layer_0 = hWinMain_Layer_0;
- g_GUI.hPrevDialog_Layer_1 = hWinMain_Layer_1;
- WM_Exec();
- //========================================================
- //Next page is the alarms one, create it
- //========================================================
- hWinAlarms = GUI_CreateDialogBox(_aWinAlarmsDialogCreate, GUI_COUNTOF(_aWinAlarmsDialogCreate), _cbDialogWinAlarms, WM_GetDesktopWindowEx(0), 0, 0);
- //========================================================
- //End the previous dialogs
- //========================================================
- GUI_EndDialog (g_GUI.hPrevDialog_Layer_0 , 0);
- GUI_EndDialog (g_GUI.hPrevDialog_Layer_1 , 0);
- g_GUI.hPrevDialog_Layer_0 = 0;
- g_GUI.hPrevDialog_Layer_1 = 0;
- WM_Exec();
This works for a while but gets stuck (memory fault) after some (variable number, not a repetitive number!) of page changes at the last WM_Exec() instruction.
Without the line:
it doesn't get stuck but obviously the old layer #1 stays on the screen (since it's visible).
There shouldn't be problems related to memory space since I'm using an external memory for the different buffer frame layers.
Could anybody suggest me a different working way to switch between these kind of dialogs or tell me what I'm doing wrong?
Thank you!
Regards,
Mark