Re: signal_handlers_destroy()
- From: zentara <zentara zentara net>
- To: gtk-perl-list gnome org
- Subject: Re: signal_handlers_destroy()
- Date: Tue, 10 Jan 2006 13:43:02 -0500
On Tue, 10 Jan 2006 18:18:20 +0100
Mario Ospelt <mospelt student ethz ch> wrote:
I wanted to use the signal_handlers_destroy() method to remove the
connected signals of my button. But something doesn't work. I always get
this error:
Can't locate object method "signal_handlers_destroy" via package
"Gtk2::Button"
Why can't the method be found? Is it spelled differently?
Maybe you are looking for signal_handler_disconnect() ?
Followed by an undef ?
#!/usr/bin/perl
use warnings;
use strict;
use Glib qw/TRUE FALSE/;
use Gtk2 '-init';
sub callback{
my ($button, $data) = @_;
print "Hello again - $data was pressed\n";
}
sub delete_event{
Gtk2->main_quit;
return FALSE;
}
my $window = Gtk2::Window->new('toplevel');
$window->set_title("Hello Buttons!");
$window->signal_connect(delete_event => \&delete_event);
$window->set_border_width(10);
my $box1 = Gtk2::HBox->new(FALSE, 0);
$window->add($box1);
my $button1 = Gtk2::Button->new("Button 1");
$button1->signal_connect(clicked => \&callback, 'button 1');
$box1->pack_start($button1, TRUE, TRUE, 0);
$button1->show;
my $button2 = Gtk2::Button->new("Button 2");
my $sigbut2 = $button2->signal_connect(clicked => \&callback, 'button 2');
$box1->pack_start($button2, TRUE, TRUE, 0);
$button2->show;
$box1->show;
$button2->signal_handler_disconnect($sigbut2 );
undef $sigbut2;
$window->show;
Gtk2->main;
__END__
--
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]