[TIDBIT] Group grab and drag

Chipp Walters chipp at chipp.com
Sun Jul 17 19:42:22 EDT 2005


Hugh,

Does it make more sense to add:

on mouseUp
   if GrabMe is true then set GrabMe to false
   pass mouseUp
end if

on mouseRelease
   mouseUp
   pass mouseRelease
end mouseRelease

rather than checking for the mouseUp state in the mouseMove handler? 
That way you are 'constantly polling' mouseUp.

Just my 2 cents...

best,

Chipp

FlexibleLearning at aol.com wrote:
> A tidbit for your Scripter's Scrapbook:
> - How to use the mouse to grab and drag a scrolling group
> (see also the 'Grab' command in the Transcript dictionary to grab and  drag 
> an object)
> 
> Put this in the script of your scrolling group...
>  
> -----
> local GrabMe,xOff,yOff
> 
> on mouseDown
> put "true" into  GrabMe
> put item 1 of the mouseLoc into xOff
> put item 2 of  the mouseLoc into yOff
> end mouseDown
> 
> on mouseMove x,y
> if  GrabMe then
> if the mouse is "up"  then
> put "false" into  GrabMe
> exit mouseMove
> end if
> set the hScroll of me to (the hScroll of me + xOff  - x)
> set the vScroll of me to (the vScroll of me + yOff -  y)
> put x into xoff
> put y into  yoff
> end if
> end mouseMove



More information about the use-livecode mailing list