http://www.perlmonks.org?node_id=749609

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

Hi, I'm writing a perl app that uses mouse events, however i'm stuck trying to get the delta value for the MouseWheel event, supposedly it should be accessible through Tkx::Ev('%D'); however all that it prints is differing array refs, ie Tcl::Ev=ARRAY(0x335715c). Is there anyway i can extract the delta value for mouseevents, here is a cutdown version of the offending code:
use Tkx; $mw = Tkx::widget->new("."); $canvas = $mw->new_tk__canvas; $canvas->g_grid(-column=>0, -row=>0, -sticky=>"nwes"); $mw->g_grid_columnconfigure(0, -weight=>1); $mw->g_grid_rowconfigure(0, -weight=>1); $canvas->g_bind('<Enter>' => sub { Tkx::focus($canvas); }); $canvas->g_bind("<1>", sub { print "Button 1\n"; }); $canvas->g_bind("<Double-1>", sub { print "Button 1x2\n"; }); $canvas->g_bind("<2>", sub { print "Button 2\n"; }); $canvas->g_bind("<3>", sub { print "Button 3\n"; }); $canvas->g_bind("<Double-3>", sub { print "Button 3x2\n"; }); $canvas->g_bind("<MouseWheel>", sub { print Tkx::Ev('%D') . "\n"; +}); Tkx::MainLoop();