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();
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|