Re: Blocking Main Window destroy siginal
- From: muppet <scott asofyet org>
- To: gtk-perl mailing list <gtk-perl-list gnome org>
- Subject: Re: Blocking Main Window destroy siginal
- Date: Sun, 19 Sep 2004 10:33:43 -0400
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;
'
:-)
--
I think it worked on the Wiley Coyote model of project management - if
at any point you looked down and realised what you were doing was
impossible then you'd instantly fail.
-- Simon Wistow
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]