Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Wheel stuck in rut

by ExReg (Priest)
on Jan 03, 2017 at 23:45 UTC ( #1178890=perlquestion: print w/replies, xml ) Need Help??

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

I would like to use my mouse wheel in a perl Tk program I have. It is used on a Windows 7 machine running Perl 5.8.8. I can get the program to recognize that a wheel event has occurred; I just can't differentiate between scrolling the wheel up and scrolling the wheel down.

The following is a small snippet demonstrating the problem.

use strict; use Tk; my $mw = MainWindow->new(); $mw->bind('<MouseWheel>'=>sub{print 'wheel moved';}); MainLoop;

The above prints 'wheel moved' regardless whether I scroll it up or down. I have looked up everything I can find and can not figure out in Windows how to distinguish the up from down. I have re-read page 370-371 in 'Mastering Perl/Tk' several times.

There are sample listings that use $_[0]->yview('scroll', but that doesn't appear to work on my machine, and I am not scrolling but calling other routines depending on the direction. I don't appear to get anything in $_[1] at all that they refer to. I have looked all over in the $_[0] and not found the answer.

I can't add any CPAN modules to solve this. I am guessing there must be some simple variable that returns the up or down-ness of the wheel movement.

Replies are listed 'Best First'.
Re: Wheel stuck in rut
by beech (Parson) on Jan 04, 2017 at 01:12 UTC

      Gadzooks! That was awesome! Just what I wanted. Thanks!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1178890]
Approved by LanX
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (10)
As of 2019-10-21 22:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?