destroying widgets and Gtk2::GladeXML



Hi, I'm a semi-newbie at GTK+ programming, and I have a question. (love
the work on gtk2-perl, by the way; exciting stuff, especially
SimpleList)

Say I have created an app using Glade, and have a Perl program that uses
it in the normal way. In this Glade project I have a main window and a
dialog that pops up when you press a toolbar button. The way I used to
do this in gtk-perl and in C was:

in the 'clicked' callback for the button to create a new GtkDialog like
so in gtk-perl:

my $dialog = new Gtk::Dialog();
$dialog->set_title("New Dialog");
# create ok button, connect signals etc
$dialog->show_all;

then in the 'clicked' handler of the OK button of the dialog, do
something like $dialog->destroy().

I find that if I do this with widgets I get from Glade via get_widget()
in gtk2, I can not use get_widget to get them again if I call destroy().
Does this mean that the Glade module initializes all windows at the
beginning? I got around the problem using $dialog->hide but I am
wondering if this is the Right Thing to do or if I am missing a more
obvious or better solution.

Thanks!

-- 
James Curbo <hannibal adtrw org>
http://www.raspberryheaven.net/~hannibal/



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