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();
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Perl/Tkx Mousewheel
by Crian (Deacon) on Mar 10, 2009 at 14:41 UTC | |
by chiron (Novice) on Mar 10, 2009 at 14:50 UTC | |
by Crian (Deacon) on Mar 10, 2009 at 15:09 UTC | |
Re: Perl/Tkx Mousewheel
by jethro (Monsignor) on Mar 10, 2009 at 16:07 UTC | |
by chiron (Novice) on Mar 10, 2009 at 17:08 UTC | |
by jethro (Monsignor) on Mar 10, 2009 at 17:47 UTC |
Back to
Seekers of Perl Wisdom