Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: Tcl/Tk mouse events

by Sandy (Curate)
on Mar 04, 2016 at 16:08 UTC ( [id://1156824]=note: print w/replies, xml ) Need Help??


in reply to Re: Tcl/Tk mouse events
in thread Tcl/Tk mouse events

Tcl::Tk

Replies are listed 'Best First'.
Re^3: Tcl/Tk mouse events
by Anonymous Monk on Mar 04, 2016 at 22:18 UTC

    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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1156824]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2024-04-24 13:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found