Subject: | Keyboard bindings don't work |
None of the keyboard bindings seem to work, including both the class bindings built into the module and calls to bindRows. Most mouse bindings work although I haven't been able to get mouse wheel scrolling to function. To show the problem just change the test.pl script that comes with the module so the MListbox selection type is "extended" instead of "browse". This should allow the user to shift-UpArrow/DownArrow to select items, and to scroll through the items with the Up/Down arrows, but it doesn't.
Attached is a simple script that should report every key press, mouse click, or mouse wheel movement. Only the mouse clicks get reported.
I've tried this on Windows XP and HP-UX with Perl 5.8.7, Tk version 804.027. MListbox is version 1.11
use strict;
use Tk;
use Tk::MListbox;
my %fruit = ( Apple => 'Red',
Banana => 'Yellow',
Grape => 'Purple',
Orange => 'Orange',
);
my $mw = MainWindow->new;
my $MLB = $mw->MListbox( -selectmode => "extended",
-columns => [["-text", "\nFruit", "-textwidth", 10],
["-text", "\nColor", "-textwidth", 10],
],
)->pack(-expand => 1, -fill => "both");
foreach (keys %fruit) {
$MLB->insert('end', [$_, $fruit{$_}]);
}
$MLB->bindRows('<KeyPress>',[\&keypress]);
$MLB->bindRows('<ButtonRelease>',[\&buttonpress, Ev('b')]);
$MLB->bindRows('<MouseWheel>',[\&buttonpress, Ev('D')]);
Tk::MainLoop;
sub keypress {
my $widget = shift;
my $e = $widget->XEvent;
my($keysym_text, $keysym_decimal) = ($e->K, $e->N);
print "Keysym=$keysym_text, numeric=$keysym_decimal\n";
}
sub buttonpress {
my $widget = shift;
my $button = $Tk::event->b;
print "Button $button released\n";
}