http://www.perlmonks.org?node_id=1186761

perltux has asked for the wisdom of the Perl Monks concerning the following question:

I have another Mousewheel question related to Tk::BrowseEntry.
On Linux when the pop-up listbox has a scrollbar, I can use the mousewheel to scroll the listbox without having to define any new bindings.
On Windows (Strawberry Perl) this does not work. The mousewheel does nothing.

So I have been trying to set up the binding myself but despite trying various subwidget targets (all those commented out in the example below) I haven't managed to get the mousewheel to scroll the listbox on Windows.

Does anybody know what the correct binding for this is?

#!/usr/bin/perl use strict; use warnings; use Tk; use Tk::BrowseEntry; my $mw=tkinit(); my $var='opt2'; my $b=$mw->BrowseEntry(-label => "Choose:", -variable => \$var, -style => 'MSWin32', -listheight => 5, -browsecmd => sub{ print STDOUT $var."\n" } ); $b->insert("end", "opt1"); $b->insert("end", "opt2"); $b->insert("end", "opt3"); $b->insert("end", "opt4"); $b->insert("end", "opt5"); $b->insert("end", "opt6"); $b->insert("end", "opt7"); $b->insert("end", "opt8"); $b->insert("end", "opt9"); $b->insert("end", "optA"); $b->insert("end", "optB"); $b->insert("end", "optC"); #my $lbx=$b->Subwidget("slistbox")->Subwidget("yscrollbar"); #my $lbx=$b->Subwidget("slistbox")->Subwidget("scrolled"); #my $lbx=$b->Subwidget("slistbox")->Subwidget("listbox"); #my $lbx=$b->Subwidget("choices"); my $lbx=$b->Subwidget("slistbox"); $lbx->bind('<MouseWheel>',[sub{$_[0]->yview('scroll',-($_[1]/120)*3,'u +nits')}, Ev("D")]); $b->pack; MainLoop;