Skip Menu |

This queue is for tickets about the Tk-MListbox CPAN distribution.

Report information
The Basics
Id: 14840
Status: open
Priority: 0/
Queue: Tk-MListbox

People
Owner: Nobody in particular
Requestors: erjm [...] yahoo.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: (no value)



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"; }
[guest - Thu Sep 29 18:36:19 2005]: Show quoted text
> 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
Ok - I'll look into it. Bindings tend to be kind of dodgy when it comes to Composite widgets... Rob
On Thu Sep 29 18:52:08 2005, RCS wrote: Show quoted text
> [guest - Thu Sep 29 18:36:19 2005]: >
> > 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
> > > Ok - I'll look into it. Bindings tend to be kind of dodgy when it comes > to Composite widgets... > > Rob
The Reason for the keyboard shortcuts not working is a simple one, but one has to be aware of it: Even though one has clicked into the widget, or even selected some entries, the widget doesn't automatically receive the keyboard input focus (most other Tk-widgets do that for you once sbd clicks into it). This has to be done manually (at least when using windows): $mlistbox->bindRows( '<Button>' , sub {$mlistbox->focus();}); Cheers Roland