Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Re: Tk::BrowseEntry listbox scrollbar with Mousewheel on Windows

by beech (Parson)
on Apr 03, 2017 at 03:47 UTC ( [id://1186763]=note: print w/replies, xml ) Need Help??

in reply to Tk::BrowseEntry listbox scrollbar with Mousewheel on Windows


See sub WheelsUp it works on windows

  • Comment on Re: Tk::BrowseEntry listbox scrollbar with Mousewheel on Windows

Replies are listed 'Best First'.
Re^2: Tk::BrowseEntry listbox scrollbar with Mousewheel on Windows
by perltux (Monk) on Apr 03, 2017 at 13:09 UTC
    Unfortunately, while your solution for my previous thread works great, I don't fully understand some of the code in your solution, so I'm a bit at a loss with regards to how to adapt it for the problem in this thread. :(


      What did I miss? You only want to yview and not select? Can you not copy WheelsUp and do yview instead of updown?


      If you remove your bind call and replace it with  $mw->focusFollowsMouse; then the Tk::Listbox natural wheel bindings work to scroll the listbox up down without changing the selection

      But if focusFollowsMouse is too much focus flipping, simply give the focus to the listbox when the button is pressed

      $b->Subwidget('arrow')->configure( -command => [ 'focus', $b->Subwidget('slistbox') ], );

      Also, $mw->WidgetDump can help you peek inside

        I don't like switching on 'focusFollowsMouse' on Windows as it has too many side effects, but many thanks for your last suggestion ($b->Subwidget('arrow')->configure(-command=>['focus',$b->Subwidget('slistbox')]);) which works fine, except for two minor flaws:

        - when clicking on the entry box the listbox also opens but in that case without functioning mousewheel

        - the currently selected option is now underlined (which is actually quite nice) except the first time the pop-up is opened for some reason always the first option is underlined, even if the entry field contains a different selected option.

        Bingo! Your suggestion has put me on the right track and I have now come up with an even better solution that eliminates the first one of the two minor flaws listed above:

        $b->Subwidget('slistbox')->bind('<Enter>', sub{$b->Subwidget('slistbox')->focus()});

        Now I only still have to find a solution for the wrong underline the first time the listbox pops up.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1186763]
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (6)
As of 2024-05-18 23:47 GMT
Find Nodes?
    Voting Booth?

    No recent polls found