Re: How do I prevent the main window from being destroyed?
- From: muppet <scott asofyet org>
- To: "Mauricio Silveira" <msilveira linuxbr com>
- Cc: <gtk-perl-list gnome org>
- Subject: Re: How do I prevent the main window from being destroyed?
- Date: Thu, 2 Oct 2003 17:54:53 -0400
On Thursday, October 2, 2003, at 01:04 PM, Mauricio Silveira wrote:
I was wondering how do i get the main window not to be destroyed, but
being hidden instead.
Like X-CD Roast, when you click the WM Decoration's "X" (close), it
opens a transient window without destroying the main window.
when you try to close the window with the window-manager, the window
manager sends a "delete-event" to the toplevel window. if you return
TRUE from the delete-event handler, gtk will consider the event handled
and the window will not be destroyed. if you return FALSE from that
handler, the default handler gets run, and that default handler
destroys the window.
so...
$toplevelwindow->signal_connect (delete_event => sub {
my ($window, $event) = @_;
if (prompt_user ("do you really want to quit?")) {
# clean things up and quit the main loop and all that.
# you can even destroy $window manually if you like.
return FALSE;
} else {
# he doesn't want to die yet!
return TRUE;
}
});
How do I do that with Gtk1-perl?
the same way you do it with gtk2-perl, which you should be using for
new development. ;-)
It is working all right with a "Quit Button".
then call the quit button handling code from the delete-event handler.
--
muppet <scott at asofyet dot org>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]