[plt-scheme] MouseClick

From: Ryan Culpepper (ryanc at ccs.neu.edu)
Date: Wed Mar 25 18:38:58 EDT 2009

CHAMLY wrote:
> Hi All,
> 
> I have a little problem With the mouse click.  I'm using  
> scheme/gui/base, And  I need to move an object with the Left click. I am 
> able to move it but not exactly like I want.
> For instance, lets say I have a function MOVE that does  (+ x 10)., In 
> my (on-event) I check if the left button is clicked with  (Left-down), 
> and I apply Move to my object.
> 
> Result, my object moves by 10. But no how do I make it move As long as 
> the left click is down?
> As long as we don't let go, The object will move by one...

I think what you mean is this: When the left mouse button is clicked, 
then the object moves by X. Every Y milliseconds after that, so long as 
the left mouse button is still depressed, the object moves by another X. 
When the mouse button is released, the object stops moving.

I'd try creating a timer% object with the appropriate callback to move 
the object. Start the timer when you see a the left mouse button go 
down, and stop it when the mouse button is released.

Ryan

> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme



Posted on the users mailing list.