FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Launching Multiple Windows

 
Post new topic   Reply to topic     Forum Index -> DFL
View previous topic :: View next topic  
Author Message
dsimcha



Joined: 24 Oct 2008
Posts: 16

PostPosted: Wed Jul 07, 2010 5:14 pm    Post subject: Launching Multiple Windows Reply with quote

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
View user's profile Send private message
Chris Miller



Joined: 27 Mar 2004
Posts: 514
Location: The Internet

PostPosted: Thu Jul 08, 2010 10:46 pm    Post subject: Re: Launching Multiple Windows Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> DFL All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group