Re: run, show ,hide,destoy



Sergey Puschin wrote:

 I have an aplication wich has some windows and wich is written with
glade-perl,
one window is main,
how can I switch between these  windows;
I can make it in such way:
from some handler of window1:

window2->run;

and in handler of window2:

window2->destroy;
Gtk->main_quit;

But when I do that, I can't reference all widgets in window2, they are
destroyed  too. I want to do some things with these  widgets.
Could someone explane me, how can I do that ?
I saw methods "show" "hide". How do they work ?
Hi Sergey, you are absolutely correct - hide is one way to do it. If you
construct the window like 

  $window2 = new window_class
  $window2->TOPLEVEL->hide; # Hides the window but does not destroy it.

and you can show it again using;
  $window2->TOPLEVEL->show; # and carry on inputting

This is much quicker if you want to use the window again. I often do:

  $class_variable ||= new window_class; 
so that it is only constructed the first time and then re-used.

I guess that you could also put some widget processing in a signal
handler connected to the window's 'delete' or 'destroy' event that would 
be called before the window is really destroyed.

BTW, if you call Gtk->main_quit anywhere in a standard Glade-Perl app,
your whole app will die.

HTH, Dermot






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