Questions on multiple windows in Glade

I created a glade file with multiple windows. When the glade launch, it
will shows all the windows and this is not desire by me. Currently, I
set others windows’ visibility to false and set it to true when needed.
I just start using glade for creating user’s interface. Previously I
just using coding the generate all the UI. I have a small utility with 2
windows. Using glade can save me 100+ lines of code and I still can
alter the UI without touching my code and this is great for me. But
there are some problems for me to use glade.

So, how do I:

  1. Initialize the windows only when I needed? I don’t want to initialize
    all the windows when the program start. Is there any equivalent methods
    to @glade[‘some_window’].new to initialize the windows?

  2. This question is related to the first question. After I close the
    window, the window will call the destroy function and destroy it self
    and set to nil. So, I am using the ‘delete-event’ signal to prevent it
    to destroy and set it to invisible. So, how do I reinitialize a window
    in glade after the window being destroy?

Thanks in advance.

Regards,
Shin Guey

Am Mittwoch, den 12.03.2008, 02:42 +0100 schrieb Shin guey Wong:

  1. Initialize the windows only when I needed? I don’t want to initialize
    all the windows when the program start. Is there any equivalent methods
    to @glade[‘some_window’].new to initialize the windows?

Hi,

the simpest way is to put every window / dialog in its own glade file.

If you want all your windows /dialogs in a single file (i can not
recommend it, if the project gets bigger) you can process single windows
like this:

@glade = GladeXML.new(@glade_file, ‘main_window’)

That will pharse @glade_file to the point, where it finds main_window
and will only show this window. But be aware, that this does not work
with the stable version, cause there is a bug in it.

  1. This question is related to the first question. After I close the
    window, the window will call the destroy function and destroy it self
    and set to nil. So, I am using the ‘delete-event’ signal to prevent it
    to destroy and set it to invisible. So, how do I reinitialize a window
    in glade after the window being destroy?

To show the window again just recall the glade command from above.

Cheers, detlef

Detlef R. wrote:

Am Mittwoch, den 12.03.2008, 02:42 +0100 schrieb Shin guey Wong:

Cheers, detlef

Thanks for the advice! It works great now. :wink:
I will split to different glade file in future. Currently I only have a
main windows and another dialog windows which contains few widget only,
so I put all them in a single glade file. Anyway, thanks again.

Regards,
Shin Guey