I see. So the info that Tcl::Ev() should come first can be found as example in http://search.cpan.org/grep?cpanid=VKON&release=Tcl-Tk-1.04&string=bind&i=1&n=1&C=9, https://metacpan.org/source/VKON/Tcl-Tk-1.04/tk-demos/widget
$T->tagBind(qw/demo <Motion>/ => [sub {
my($x, $y) = (shift,shift);
my($text, $sv) = @_;
#my $e = $text->XEvent;
#my($x, $y) = ($e->x, $e->y);
my $new_line = $text->index("\@$x,$y linestart");
if ($new_line ne $last_line) {
$text->tagRemove(qw/hot 1.0 end/);
$last_line = $new_line;
$text->tagAdd('hot', $last_line, "$last_line lineend");
}
show_stat $sv, $text, $text->index('current');
}, Tcl::Ev('%x','%y'), \$STATUS_VAR]
);
It is also documented in Tcl
4. As a special case, there is a mechanism to deal with Tk's special event variables (they are mentioned as '%x', '%y' and so on throughout Tcl). When creating a subroutine reference that uses such variables, you must declare the desired variables using Tcl::Ev as the first argument to the subroutine.
-
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.