can_activate_accel



Hello,

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,
however.

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.

-----------------
#!/usr/bin/perl

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;

$window->add($vbox);
$vbox->pack_start($button,1,1,0);
$vbox->pack_start($entry,1,1,0);

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

$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; });

$window->show_all;

Gtk2->main();

-------------------


Justin



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