[Glade-users] Best Practice for Glade.XML - open/close new window



Tristan,

You were right.  I can't remember if the exact code I posted was causing the signals to fire twice, but I've 
changed things a little now and everything seems to be working well (for real this time).  Here's how it 
works:

1. At app init, create all initially non-visible windows defined in the .glade file.   
gxml = new Glade.XML(sPATH_TO_GLADE_XML, null, null);

2. Show a window:
gxml.Construct(sPATH_TO_GLADE_XML, sWindowName, null)
wnd = (Gtk.Window)gxml.GetWidget(sWindowName);
gxml.Autoconnect(this);
wnd.Visible = true;

3. Hide a window:
wnd.Visible = false;

I'm really not certain what the difference is between Glade.XML.Construct() and using the constructor. I 
figured that it saved creating and destroying the Glade.XML object, althought I'm not totally sure as I can't 
find any good documentation at http://www.go-mono.com/docs/
or at http://docs.gotmono.net/ as the latter doesn't seem to be working right now.  All that I found was this 
sentance:

           This routine can be used by bindings (such as gtk--) to help           construct an XML object, if 
it is           needed.  

Regards,

--Travis

Tristan Van Berkom <tristan van berkom gmail com> wrote: Travis Staloch wrote:
[...]

3. When I want to show a window, using:
 wnd = (Gtk.Window)gxml.GetWidget(sWindowName);
 gxml.Autoconnect(this);
 wnd.Visible = true;
 

I might be reading your code wrong, but it looks like you
are connecting signals every time you show the window...
remember that the signals arent disconnected just because
you close a window... so handlers could start to be called
more than once for a given event...

Cheers,
                                -Tristan



                                
---------------------------------
Do you Yahoo!?
 Next-gen email? Have it all with the  all-new Yahoo! Mail Beta.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/glade-users/attachments/20060616/8ab93c28/attachment.html



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]