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;

In reply to Tk::BrowseEntry listbox scrollbar with Mousewheel on Windows by perltux

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.