$Bill
unread,Oct 1, 2018, 8:02:14 PM10/1/18You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
Given a frame with a Listbox in it, I can't figure out how to bind
the mouse wheel to scroll the Listbox.
$lf1 = $mw->Labelframe(...
$lb1 = $lf1->Scrolled('Listbox',
I've tried using Widget.pm's YscrollBind, YMouseWheelBind, MouseWheelBind,
and even manually adding an event and binding it to yview/scroll.
Can someone insert a couple of lines of code below that works to bind
the mouse wheel on Win32 to scroll the Listbox content vertically ?
TIA, Bill
Test template:
#!perl --
use strict;
use warnings;
use Tk;
my $mw = new MainWindow (-title => "Test ($$)");
my $lf1 = $mw->Labelframe(-text => 'Test MW Bind',
-relief => 'ridge')->pack(-fill => 'both', -expand => 1
);
my $lb1 = $lf1->Scrolled('Listbox', -scrollbars => 'ose',
-width => 40, -height => 4, -selectmode => 'extended')->pack(
-side => 'bottom', -fill => 'both', -expand => 1
);
# bind y scroll to mouse wheel here
# fill with some data for testing
$lb1->insert('end', 'Testing 1234567890 Testing 1234567890') for (1 .. 20);
MainLoop ();
__END__