Hi,

This seems to work, UTSL saves the day

#!/usr/bin/perl -- use strict; use warnings; use Tk; use Tk::BrowseEntry; { my $mw = tkinit(); my $var = 'initial label'; my $b = $mw->BrowseEntry(-label => "Label", -variable => \$var); $b->insert("end", "opt1"); $b->insert("end", "opt2"); $b->insert("end", "opt3"); $b->pack; WheelsUp($b ); $mw->focusFollowsMouse; MainLoop; } sub WheelsUp { my( $b ) = @_; my $mw = $b->toplevel; for my $wi ( $b, map { $_, $_->children } $b->children ){ $mw->bind( $wi, '<MouseWheel>',[ \&wheel_browse, $b, Tk::Ev('D +')]); $mw->bind( $wi, '<4>',[ \&wheel_browse , $b, 120]); $mw->bind( $wi, '<5>',[ \&wheel_browse , $b, -120]); $mw->bind( $wi, '<Up>',[ \&wheel_browse , $b, 1]); $mw->bind( $wi, '<Down>',[ \&wheel_browse , $b, -1]); } } sub wheel_browse { my( $main, $bro, $num ) = @_; my $lb = $bro->Subwidget("slistbox")->Subwidget('listbox'); $num = $num < 0 ? -1 : 1; $lb->UpDown( $num ); my $var_ref = $bro->cget( '-textvariable' ); $$var_ref = $lb->getSelected; return; } __END__

In reply to Re: How do I bind the Mousewheel to Tk::BrowseEntry? by beech
in thread How do I bind the Mousewheel to Tk::BrowseEntry? 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.