Hello emWin-users,
I dont want to place a huge code here so I will try to compress it and to concentrate on the important part of it:
Can you tell me what is the best way to delete a DialogBox with a WindowAsChild on it (invisible one) and to create a new DialogBox right after that (for example after pressing a button). I did the following, but it sometimes crashes:
case ID_BUTTON_NEXT:
//WHAT ABOUT THIS :
WM_DeleteWindow(hWin1);
WM_DeleteWindow(hWin2);
GUI_Clear();
NextScreen();
GUI_SetOrg(0, 480);
break;
}
break;
}
break;
default:
WM_DefaultProc(pMsg);
}
}
/*********************************************************************
*
* Public code
*
**********************************************************************
*/
/*********************************************************************
*
* MainTask
*/
void MainScreen(void) {
WM_SetCreateFlags(WM_CF_MEMDEV);
hWin1 = GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbCallback, WM_HBKWIN, 0, 0);
hWin2 = WM_CreateWindowAsChild(100, 100, 320, 220, WM_HBKWIN, WM_CF_SHOW | WM_CF_HASTRANS | WM_CF_MEMDEV, _cbWin, 0);
}
/// NEXT SCREEN ////
void NextScreen(void) {
WM_SetCreateFlags(WM_CF_MEMDEV);
hWin3 = GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbCallback, WM_HBKWIN, 0, 0);hWin4 = WM_CreateWindowAsChild(100, 580, 320, 220, WM_HBKWIN, WM_CF_SHOW | WM_CF_HASTRANS | WM_CF_MEMDEV, _cbWin, 0);
}
Thank you in advance!Ivo
I dont want to place a huge code here so I will try to compress it and to concentrate on the important part of it:
Can you tell me what is the best way to delete a DialogBox with a WindowAsChild on it (invisible one) and to create a new DialogBox right after that (for example after pressing a button). I did the following, but it sometimes crashes:
case ID_BUTTON_NEXT:
//WHAT ABOUT THIS :
WM_DeleteWindow(hWin1);
WM_DeleteWindow(hWin2);
GUI_Clear();
NextScreen();
GUI_SetOrg(0, 480);
break;
}
break;
}
break;
default:
WM_DefaultProc(pMsg);
}
}
/*********************************************************************
*
* Public code
*
**********************************************************************
*/
/*********************************************************************
*
* MainTask
*/
void MainScreen(void) {
WM_SetCreateFlags(WM_CF_MEMDEV);
hWin1 = GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbCallback, WM_HBKWIN, 0, 0);
hWin2 = WM_CreateWindowAsChild(100, 100, 320, 220, WM_HBKWIN, WM_CF_SHOW | WM_CF_HASTRANS | WM_CF_MEMDEV, _cbWin, 0);
}
/// NEXT SCREEN ////
void NextScreen(void) {
WM_SetCreateFlags(WM_CF_MEMDEV);
hWin3 = GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbCallback, WM_HBKWIN, 0, 0);hWin4 = WM_CreateWindowAsChild(100, 580, 320, 220, WM_HBKWIN, WM_CF_SHOW | WM_CF_HASTRANS | WM_CF_MEMDEV, _cbWin, 0);
}
Thank you in advance!Ivo