Re: strange behavior in bind

From: Erick Gallesio <eg_at_unice.fr>
Date: Thu, 11 Mar 1999 19:16:32 +0100 (CET)

Brian Denheyer writes:
 
Oops this is my fault.
In fact I've just forgotten to verify that the parameters are one
character wide. In fact here your result is the concatenation of the
x field (x-coord of the mouse) and the c filed (a counter) of an X
event. (Try to name your variable xxx and you'll see that the value
will concatenated three times :-\)

Anyway all the stuff dealing with binding is something that I'm not
very proud of.

Hereafter is a patch file which corrects the bug (only the first
character of a variable is significant -- i.e. xc and a are now
equivalent).


> The example code works as follows :
>
> Simply moving the mouse works "normally". If you press shift while
> moving the mouse, motion1 is invoked and you will see that the
> coordinates reported back seems to be 10x what they are supposed to
> be. Notice that the only difference is the name of the arguments, x
> and y as compared to xc and yc. Of course it might be that 0 is being
> appended to the results. Either way it's very strange...
>
>
> Brian
>
> ------------------------------------------------
> (require "Tk-classes")
>
> (define c (make <canvas>))
>
> (pack c)
>
> (define motion
> (lambda (x y)
> (format #t "~A, ~A\n" x y)))
>
> (define motion1
> (lambda (xc yc)
> (format #t "~A, ~A\n" xc yc)))
>
> (bind c "<Motion>" motion)
> (bind c "<Shift-Motion>" motion1)


                -- Erick






Received on Thu Mar 11 1999 - 21:41:35 CET

This archive was generated by hypermail 2.3.0 : Mon Jul 21 2014 - 19:38:59 CEST