Hi.
Using a nested window in a project I made based on the following example gives an error.
I want to enter the sub-menus by pressing the buttons.
For example
Settings(dialog1)-> Display(dialog2)- -> Resolution(dialog3)
Settings(dialog1)--> Audio(dialog4)--> Device(dialog5)
Display All
What could be the problem?
Regards,
Hakan
Using a nested window in a project I made based on the following example gives an error.
I want to enter the sub-menus by pressing the buttons.
For example
Settings(dialog1)-> Display(dialog2)- -> Resolution(dialog3)
Settings(dialog1)--> Audio(dialog4)--> Device(dialog5)
C Source Code
- C Source Code
- #include "DIALOG.h"
- /*********************************************************************
- *
- * Externals
- *
- **********************************************************************
- */
- /*********************************************************************
- *
- * Defines
- *
- **********************************************************************
- */
- #define ID_WINDOW_00 (GUI_ID_USER + 0x00)
- #define ID_TEXT_00 (GUI_ID_USER + 0x01)
- #define ID_BUTTON_00 (GUI_ID_USER + 0x03)
- #define ID_WINDOW_10 (GUI_ID_USER + 0x00)
- #define ID_TEXT_10 (GUI_ID_USER + 0x01)
- #define ID_BUTTON_10 (GUI_ID_USER + 0x03)
- /*********************************************************************
- *
- * Static data
- *
- **********************************************************************
- */
- /*********************************************************************
- *
- * _aDialogCreate
- */
- static const GUI_WIDGET_CREATE_INFO _aDialogCreate0[] = {
- { WINDOW_CreateIndirect, "Window", ID_WINDOW_00, 0, 0, 320, 240, 0, 0x0, 0 },
- { TEXT_CreateIndirect, "Dialog 1", ID_TEXT_00, 100, 100, 120, 40, 0, 0x0, 0 },
- { BUTTON_CreateIndirect, "Switch", ID_BUTTON_00, 110, 170, 80, 20, 0, 0x0, 0 },
- };
- /*********************************************************************
- *
- * _aDialogCreate
- */
- static const GUI_WIDGET_CREATE_INFO _aDialogCreate1[] = {
- { WINDOW_CreateIndirect, "Window", ID_WINDOW_10, 0, 0, 320, 240, 0, 0x0, 0 },
- { TEXT_CreateIndirect, "Dialog 2", ID_TEXT_10, 100, 100, 120, 40, 0, 0x0, 0 },
- { BUTTON_CreateIndirect, "Switch", ID_BUTTON_10, 110, 170, 80, 20, 0, 0x0, 0 },
- };
- static WM_HWIN _hDialog0;
- static WM_HWIN _hDialog1;
- /*********************************************************************
- *
- * Static code
- *
- **********************************************************************
- */
- /*********************************************************************
- *
- * _cbDialog1
- */
- static void _cbDialog1(WM_MESSAGE * pMsg) {
- WM_HWIN hItem;
- int NCode;
- int Id;
- switch (pMsg->MsgId) {
- case WM_INIT_DIALOG:
- //
- // Initialization of 'Window'
- //
- hItem = pMsg->hWin;
- WINDOW_SetBkColor(hItem, GUI_MAKE_COLOR(0x00EFFFBF));
- //
- // Initialization of 'Dialog 1'
- //
- hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_10);
- TEXT_SetTextColor(hItem, GUI_MAKE_COLOR(0x00000000));
- TEXT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER);
- TEXT_SetFont(hItem, GUI_FONT_32B_1);
- break;
- case WM_NOTIFY_PARENT:
- Id = WM_GetId(pMsg->hWinSrc);
- NCode = pMsg->Data.v;
- switch(Id) {
- case ID_BUTTON_10: // Notifications sent by 'Switch'
- switch(NCode) {
- case WM_NOTIFICATION_RELEASED:
- WM_HideWindow(_hDialog1);
- WM_ShowWindow(_hDialog0);
- break;
- }
- break;
- }
- break;
- default:
- WM_DefaultProc(pMsg);
- break;
- }
- }
- /*********************************************************************
- *
- * _cbDialog0
- */
- static void _cbDialog0(WM_MESSAGE * pMsg) {
- WM_HWIN hItem;
- int NCode;
- int Id;
- switch (pMsg->MsgId) {
- case WM_INIT_DIALOG:
- //
- // Initialization of 'Window'
- //
- hItem = pMsg->hWin;
- WINDOW_SetBkColor(hItem, GUI_MAKE_COLOR(0x00100040));
- //
- // Initialization of 'Dialog 1'
- //
- hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_00);
- TEXT_SetTextColor(hItem, GUI_MAKE_COLOR(0x00FFFFFF));
- TEXT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER);
- TEXT_SetFont(hItem, GUI_FONT_32B_1);
- break;
- case WM_NOTIFY_PARENT:
- Id = WM_GetId(pMsg->hWinSrc);
- NCode = pMsg->Data.v;
- switch(Id) {
- case ID_BUTTON_00: // Notifications sent by 'Switch'
- switch(NCode) {
- case WM_NOTIFICATION_RELEASED:
- WM_HideWindow(_hDialog0);
- WM_ShowWindow(_hDialog1);
- break;
- }
- break;
- }
- break;
- default:
- WM_DefaultProc(pMsg);
- break;
- }
- }
- /*********************************************************************
- *
- * _cbBk
- */
- static void _cbBk(WM_MESSAGE * pMsg) {
- switch (pMsg->MsgId) {
- case WM_PAINT:
- GUI_SetBkColor(GUI_GRAY);
- GUI_Clear();
- break;
- default:
- WM_DefaultProc(pMsg);
- break;
- }
- }
- /*********************************************************************
- *
- * Public code
- *
- **********************************************************************
- */
- /*********************************************************************
- *
- * MainTask
- */
- void MainTask(void) {
- GUI_Init();
- WM_SetCallback(WM_HBKWIN, _cbBk);
- _hDialog0 = GUI_CreateDialogBox(_aDialogCreate0, GUI_COUNTOF(_aDialogCreate0), _cbDialog0, WM_HBKWIN, 0, 0);
- _hDialog1 = GUI_CreateDialogBox(_aDialogCreate1, GUI_COUNTOF(_aDialogCreate1), _cbDialog1, WM_HBKWIN, 0, 0);
- WM_HideWindow(_hDialog1);
- while (1) {
- GUI_Delay(100);
- }
- }
Regards,
Hakan