perlquestion
ExReg
<p>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.
</p>
<p>The following is a small snippet demonstrating the problem.
</p>
<c>use strict;
use Tk;
my $mw = MainWindow->new();
$mw->bind('<MouseWheel>'=>sub{print 'wheel moved';});
MainLoop;
</c>
<p>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.
</p>
<p>There are sample listings that use <c>$_[0]->yview('scroll'</c>, 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 <c>$_[1]</c> at all that they refer to. I have looked all over in the <c>$_[0]</c> and not found the answer.
</p>
<p>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.
</p>