Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Perl-Tk MouseWheel support for Scale

by thundergnat (Deacon)
on Mar 06, 2015 at 22:01 UTC ( [id://1119123]=note: print w/replies, xml ) Need Help??


in reply to Perl-Tk MouseWheel support for Scale

Your widget won't respond to bound events if it doesn't have the focus. Try putting a $scale->focus; somewhere before the MainLoop;

This may or may not be of help to you. It assumes that there aren't any other widgets which may grab focus in your application. You may need to bind in some event to set the focus on the $scale when you want it to respond to mouse events. YMMV.

Replies are listed 'Best First'.
Re^2: Perl-Tk MouseWheel support for Scale
by perltux (Monk) on Mar 06, 2015 at 23:29 UTC
    Bingo!

    With $scale->focus; the mousewheel works on Windows too just like on Linux!

    Now I have to figure out how I can get FocusFollowsMouse on Windows as on Unix/Linux...

      Well, focusFollowsMouse works on win32 just fine  perl -MTk -le " $mw = tkinit; $mw->Button->pack for 1..3; $mw->  focusFollowsMouse ; MainLoop; "

      But are you sure you want to do that?

      DynaMouseWheelBind allows scrolling at mouse position without changing focus :P

        DynaMouseWheelBind does not seem to work with Tk::Scale, I get:

        Tk::Error: Failed to AUTOLOAD 'Tk::Scale::yview' at /usr/lib/perl5/ven +dor_perl/5.10.0/i386-linux-thread-multi/Tk/Submethods.pm line 19 Carp::croak at /usr/lib/perl5/5.10.0/Carp.pm line 44 Tk::Widget::__ANON__ at /usr/lib/perl5/vendor_perl/5.10.0/i386-linux- +thread-multi/Tk/Widget.pm line 347 Tk::Widget::__ANON__ at Tk/DynaMouseWheelBind.pm line 54 <<DynaMouseWheel>> (command bound to event) Tk::Error: Failed to AUTOLOAD 'Tk::Scale::yview' at /usr/lib/perl5/ven +dor_perl/5.10.0/i386-linux-thread-multi/Tk/Submethods.pm line 19


        $mw->focusFollowsMouse seems to work fine with regards to mousewheel support for Scale widgets, but on Windows I get weird dotted boxes around Checkbuttons and Radiobuttons when the mouse passes over them, that persist even after the mouse is already over some other widget. :(

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (5)
As of 2024-04-18 04:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found