Constraining the pointer within a rect
Peter T. Evensen
pevensen at siboneylg.com
Thu Aug 17 11:04:28 EDT 2006
I think you are getting recursion. Setting the screenMouseLoc causes
mouseMove to be sent. You might want to try locking messages before
setting screenMouseLoc.
At 08:02 AM 8/17/2006, you wrote:
>>Greetings
>>
>>This is my annual mailing on this topic. I won't bore you with why I
>>need to do this deprecated act, but I do.
>>
>>Basically I need the pointer to refuse to move outside a rect, and just
>>'bounce' against the edge. No recoil or anything fancy, just stop until
>>the user moves elsewhere with the rect. I had a script that worked in a
>>standalone in 1.1.1. It was inelegant, but effectively. It became
>>painfully slow and jerky in 2.x.
>
>Hi David,
>basically, this modified version of the script works:
>
>on mouseMove X,Y
> if the hilite of button "constrain" is true then
> put the rect of fld "container" into Fred
> put min (item 3 of Fred , max (item 1 of Fred, X)) into X
> put min (item 4 of Fred , max (item 2 of Fred, Y)) into Y
>
> get the globalloc of (X,Y)
> set the screenMouseLoc to it
> end if
>end mouseMove
>
>
>but it is *incredibly* slow on OSX (not tried on Windows). I'm not quite
>sure what it is that's slowing this down - does setting the ScreenMouseLoc
>send a MouseMove message itself? There's bound to be a better way of doing
>this?
>--
>Phil Jimmieson phil at csc.liv.ac.uk (UK) 0151 795 4236 (Mobile) 07976 983164
>Computer Science Dept., Liverpool University, Ashton Building, Ashton Street
>Liverpool L69 7ZF http://www.csc.liv.ac.uk/~phil/
> I used to sit on a special medical board... ...but now I use this ointment.
>_______________________________________________
>use-revolution mailing list
>use-revolution at lists.runrev.com
>Please visit this url to subscribe, unsubscribe and manage your
>subscription preferences:
>http://lists.runrev.com/mailman/listinfo/use-revolution
Peter T. Evensen
http://www.PetersRoadToHealth.com
314-629-5248 or 888-682-4588
More information about the use-livecode
mailing list