View previous topic :: View next topic |
Author |
Message |
dsimcha
Joined: 24 Oct 2008 Posts: 16
|
Posted: Wed Jul 07, 2010 5:14 pm Post subject: Launching Multiple Windows |
|
|
How does one launch multiple GUI windows at application startup? I'm new to GUI programming and it seems like, once you launch one window, that window spends all its time in the event handler loop, so there's no way to launch another one from the same thread w/o triggering an event.
On the other hand, it appears that DFL is designed such that there is only supposed to be one GUI thread. When I try to launch windows from multiple thread, I get bizarre race conditions.
What is the workaround here? Is there some dummy event that can be triggered on a main form from across thread boundaries? |
|
Back to top |
|
|
Chris Miller
Joined: 27 Mar 2004 Posts: 514 Location: The Internet
|
Posted: Thu Jul 08, 2010 10:46 pm Post subject: Re: Launching Multiple Windows |
|
|
You can call show before calling Application.run:
Code: | void main()
{
(new Form2()).show();
Application.run(new Form1());
} |
but the one passed to Application.run will still be considered the "main" form and exit the application when closed. You can alternatively not pass any form to Application.run (and call show on both forms) and handle exiting the application yourself.
DFL currently doesn't support creating and managing forms on multiple threads (it's in todo). There is invoke to run code on the main thread, like if you wanted to do background processing in another thread and then output the results to the form via invoke. |
|
Back to top |
|
|
|