detecting mouse motion at mouse button release 
Author Message
 detecting mouse motion at mouse button release

Is there a way to detect if the mouse is moving on a button release?

Say I have bindings for both <Motion> and <ButtonRelease>. In <Motion>'s
script I update the mouse coordinates (i.e. set sx %x; set sy %y). If the
mouse is moving, the script bound to <motion> will be executed first, and
so sx is equal to %x when entering <BR>'s script, then I can't rely on if
%x == $sx.

What to do??

Thanks!

Tina



Thu, 28 Oct 2004 04:29:39 GMT  
 detecting mouse motion at mouse button release


Quote:
> Is there a way to detect if the mouse is moving on a button release?

> Say I have bindings for both <Motion> and <ButtonRelease>. In <Motion>'s
> script I update the mouse coordinates (i.e. set sx %x; set sy %y). If the
> mouse is moving, the script bound to <motion> will be executed first, and
> so sx is equal to %x when entering <BR>'s script, then I can't rely on if
> %x == $sx.

Tina,

What exactly are you trying to do with the combination of the <Motion> and
<BR> events?  Maybe there is a better way, but I don't understand the
"bigger picture" of what you are trying to accomplish.  Can you provide more
details?

Jeff



Thu, 28 Oct 2004 04:54:12 GMT  
 detecting mouse motion at mouse button release
Hi Jeff,

I'm implementing persistent movement of a screen object -- pressing the
left mouse button rotates the object, and the rotation continues only if
the mouse is moving at the time the button is released (and it keeps
rotating regardless of what happends after the release).

Hope that clears up my question =).

Thanks,

Tina

Quote:



> > Is there a way to detect if the mouse is moving on a button release?

> > Say I have bindings for both <Motion> and <ButtonRelease>. In <Motion>'s
> > script I update the mouse coordinates (i.e. set sx %x; set sy %y). If the
> > mouse is moving, the script bound to <motion> will be executed first, and
> > so sx is equal to %x when entering <BR>'s script, then I can't rely on if
> > %x == $sx.

> Tina,

> What exactly are you trying to do with the combination of the <Motion> and
> <BR> events?  Maybe there is a better way, but I don't understand the
> "bigger picture" of what you are trying to accomplish.  Can you provide more
> details?

> Jeff



Thu, 28 Oct 2004 05:09:12 GMT  
 detecting mouse motion at mouse button release

Quote:
> I'm implementing persistent movement of a screen object -- pressing the
> left mouse button rotates the object, and the rotation continues only if
> the mouse is moving at the time the button is released (and it keeps
> rotating regardless of what happends after the release).

Try using the mouse motion events to set the speed, by calculating
the ratio of distance and time since last event. Then, rotate
with this speed, on something like periodic ('after') callbacks.
You will not even need mouse up events this way.


Thu, 28 Oct 2004 14:10:45 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. left mouse button = right mouse button

2. Mice, mice, mice, mice ...

3. Mice, mice, mice, mice ...

4. mouse motion with button binding

5. Detect right button mouse clicks

6. Canvas item for mouse button release?

7. leftmouse button is right mouse button ???

8. Restricting mouse motion on a CwForm or CwDrawingArea.

9. mouse motion causes jump in cpu usage

10. wish80 crash on mouse motion

11. mouse-motion-collapsing in tk3.6

12. Tight coupling between mouse motion and event handler.

 

 
Powered by phpBB® Forum Software