[Gtk-sharp-list] Multiple Windows and Application.Init problem

Rafael Teixeira Rafael Teixeira <monoman@gmail.com>
Tue, 5 Apr 2005 17:29:30 -0300


Application.Init() and Run() MUST be in a static method, be it the
'main' entry method or called from it.

Also see that Application.Run() is a blocking call, it will run
nearly-forever in the message dequeueing loop and won't come back
until the end of the application is queued with Application.Quit().

Your Login Window can and should be executed in modal fashion, you are
just confusing things...

It should be inherited from Dialog and then you can call it's Run
method (after calling Application.Init(), but without needing to go
into the blocking Application.Run())...

HIH,


On Apr 5, 2005 4:34 PM, ajadex <ajadex@matcom.uh.cu> wrote:
>  
> Hi, I'm making an Application with a Login and a Main Windows. First of all
> I couldn't make the Login Window modal but I make a temporal patch and I
> starting the Login Window as the principal and then calling the Main Window:
>   
>  
> 
> LoginWindow.cs 
> 
> public void Show(){ 
> 
> Application.Init(); 
> 
> XML gxml = new XML(null,
> "CoolMessenger.glade_widgets.cool-messenger.glade",
> "W_LoginWindow", null); 
> 
> gxml.Autoconnect(this); 
> 
> Application.Run(); 
> 
> } 
> 
>   
> 
> private void whenFinished(IAsyncResult ar){ 
> 
> //Do login verifications.... 
> 
> _UserData = new UserData(Tb_Alias.Text, Tb_Password.Text); 
> 
> W_LoginWindow.Destroy(); 
> 
> new MainWindow(_UserData); 
> 
>  
> 
> } 
> 
>   
> 
>   
> 
> MainWindow.cs 
> 
> public MainWindow(UserData userData){ 
> 
> XML gxml = new XML(null,
> "CoolMessenger.glade_widgets.cool-messenger.glade",
> "W_MainWindow", null); 
> 
> gxml.Autoconnect(this); 
> 
> ....Some user data stuff 
> 
> } 
> But the MainWindow, also designed in glade, doesn't wake up and the
> application freeze. I try inserting Application.Init and Application.Run in
> the MainWindow also and the Window is shown nothing works. 
>   
> Any help? 
>   
>   
>                          Thanks, Ajadex. 


-- 
Rafael "Monoman" Teixeira
---------------------------------------
I'm trying to become a "Rosh Gadol" before my own eyes. 
See http://www.joelonsoftware.com/items/2004/12/06.html for enlightment.
It hurts!