Re: Blocking Main Window destroy siginal
- From: "Kevin C. Krinke" <kckrinke opendoorsoftware com>
- To: gtk-perl-list gnome org
- Subject: Re: Blocking Main Window destroy siginal
- Date: Sun, 19 Sep 2004 10:58:08 -0400
On Sun, 2004-09-19 at 10:33, muppet wrote:
On Sep 19, 2004, at 9:43 AM, Kevin C. Krinke wrote:
my $button = new Gtk2::Button ( "toggle block" );
or, you could use an actual ToggleButton and avoid the state variable
while providing visual feedback, like so:
/usr/bin/perl -e '
use strict;
use Glib qw( TRUE FALSE );
use Gtk2 -init;
my $window = new Gtk2::Window ( "toplevel" );
my $toggle = new Gtk2::ToggleButton ( "block" );
$window->add($toggle);
$toggle->signal_connect( toggled => sub {
$_[0]->set_label ($_[0]->get_active
? "unblock"
: "block");
});
$window->signal_connect( "delete-event" => sub {
# if we are blocked, do nothing:
return TRUE if $toggle->get_active;
# otherwise stop the main loop and let
# the default handler destroy the window.
Gtk2->main_quit;
return FALSE;
});
$window->show_all();
main Gtk2;
'
:-)
Show off ;-)
Wait a sec... is that the pot calling the kettle what? hehe
--
Kevin C. Krinke <kckrinke opendoorsoftware com>
Open Door Software Inc.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]