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.