Home » Community » Newbie corner » Multiple main windows, but only one active (Multiple main windows, but only one active)
Multiple main windows, but only one active [message #48578] |
Tue, 01 August 2017 00:36 |
Jose Luis
Messages: 3 Registered: February 2015
|
Junior Member |
|
|
Hi,
This is my first message on the forum.
I'm making an application in which I want to be able to open a new main window and close the previous one.
That is, I want to re-run my program from scratch without having to close it or reset all variables manually.
I use next code:
UI_APP_MAIN
{
(new App)->OpenMain();
Ctrl::EventLoop();
}
And I call next function to close the active main windows and open another main window:
void App::CloseAndOpen()
{
delete this;
(new App)->OpenMain();
}
The function CloseAndOpen seems to work correctly if I only use it once or twice, but I have tried it intensively, and after several consecutive calls the program fails and closes (not always at the same number of consecutive calls).
Can be the failure caused by the repetitive and consecutive use of OpenMain()?
Is there any better way to get what I want ?. Is something missing from my code?
Thanks.
|
|
|
|
|
|
|
Goto Forum:
Current Time: Fri Nov 01 02:00:25 CET 2024
Total time taken to generate the page: 0.01989 seconds
|