If I understand the documentation correctly, one should be able to disable
the keyboard accelerator for a widget by connecting to the
can_activate_accel signal and returning false. This isn't working for me,

Can someone tell me if I'm doing something wrong, or is there a bug in
gtk/gtk-perl? Example program below... using gtk 2.4.9 and gtk-perl 1.092,
typing a "b" in the text entry will click the button despite the
can_activate_accel handler.


use Gtk2 qw(-init);

my $window = Gtk2::Window->new;
my $button = Gtk2::Button->new('button');
my $entry = Gtk2::Entry->new;
my $vbox = Gtk2::VBox->new(0,2);
my $accel = Gtk2::AccelGroup->new;


$button->add_accelerator('clicked', $accel, ord('b'), [], [] );

$window->signal_connect(destroy => sub { Gtk2->main_quit; });
$button->signal_connect(clicked => sub { print "clicked\n"; });
$button->signal_connect(can_activate_accel => sub { return 0; });





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