[Gtk-sharp-list] Using a Dialog box defined with glade with an Gtk.Dialog herited class

mlgs mlgs at arsis.net
Wed Nov 15 19:18:34 EST 2006


On Wed, 2006-11-15 at 23:06 +0100, lordphoenix wrote:
> Le Wed, 15 Nov 2006 21:21:28 +0100,
> Gilles Fabio <gilles.fabio at gmail.com> a écrit :
> 
> > Mmm... Sounds weird :/ Could you please upload somewhere your glade
> > file and sample code? Or could you please copy-past your original
> > source code? Because I have no idea. Everything works fine on my
> > platform.
> 
> All sources are available here : 
> http://viewvc.tuxfamily.org/svn_litemanager_main/trunk
> 
> It's an SQLite database administration tool I attach an sqlite database
> to the message if you need one to make tests
> Thanks for your help :)
> 

I will try to be explanatory enough (I moved few things so I could
explain it easier)

//Glade.XML gxml = new Glade.XML (null, "gui.glade", "dlgcreateindex",
null);

*** I rather used new window so I could be sure it works, it fails with
your dialog though. Meaning there is a problem with your glade file

Glade.XML gxml = new Glade.XML (null, "gui2.glade", "window1", null);

*** So,... now you loaded window

//dlgCreateIndex dlgindex = new dlgCreateIndex();
Gtk.Dialog dlgindex = new Gtk.Dialog();

*** Created empty dialog, which has no relation with the one you loaded
at all. Another base dialog window, so here you actually have two dialog
windows running

gxml.Autoconnect (dlgindex);

*** Shows loaded dialog, which is as you specified in Glade file modal

                        int result = 0;

*** Shows empty dialog, and while your dialog seems corrupted somehow
you didn't saw both windows. Try your source with mine and you'll see
what I mean. Remember, loaded should already be shown.

                        dlgindex.Show(); // or Run

*** Instead of Run try rather waiting for dialog to become inactive and
use local vars to capture result. Worked for me, but then again you
might not be the only one missing something. I could be missing
something too:) Nobody is perfect:)

/*                      if (result==(int)ResponseType.Ok){
                                Console.WriteLine("OK");
                                Console.WriteLine("texte:
"+dlgindex.SqlText);
                        }*/

*** If you follow my way you should wait here before destroying because
you probably wouldn't like to destroy still active class

                        Console.WriteLine ("Before destroy");
                        dlgindex.Destroy();

MY EXPLANATION, WHERE YOU WENT WRONG
====================================
All your troubles rise from one wrong assumption. You thought that you
have to create Window and then load glade file into it. Try with
dlgCreateIndex which is not subclassing Dialog and you won't work with
doubled windows.


Hope it helps

m.


> _______________________________________________
> Gtk-sharp-list maillist  -  Gtk-sharp-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list



More information about the Gtk-sharp-list mailing list