fake grabber

Chris Condit ccondit at geo.umass.edu
Thu Aug 23 16:23:47 EDT 2007


Has anyone experimented with making a grabber (as was found in 
SuperCard), that would let your drag a scrolling group (including an 
image, and other controls) around, when you (in the case below) 
depress either the command or control keys with a mouseDown and 
invoke this fakeGrabber script?

My problem is that the process is sometimes slow, and also gets 
confused and is left with the grabber icon showing.

And does anyone know if there is a request to add a "grabber" to 
Revolution?  last reference i saw to grabber in the listServ was 2004!

---(this is part of the script to the scrolling group named 
"overlayandImageGroup":
on MouseDown
   if the commandKey is down or the controlKey is down then
     set the tool to browse
     set the cursor to 11079 -- (a "grabber" hand)
     FakeGrabber
     --set the cursor to hand
   else send mouseDown to stack "Map"
end mouseDown

--and it calls this in the mainstack's script:

on FakeGrabber
   put 3 into Threshold
   put the mouseLoc into oldLoc
   put the short name of this stack into thisStacksName
   #to keep the centering on wanted feature from overscrolling
   put the width of stack thisStacksName into StackWidth
   put the height of stack thisStacksName into StackHeight
   put the width of image "theImageBox" into theImageBoxBotRtX
   put the height of image "theImageBox" into theImageBoxBotRtY
   put (theImageBoxBotRtX + 16) - StackWidth into MaxScrollX
   put (theImageBoxBotRtY + 16) - StackHeight into MaxScrollY

   repeat forever
     if the mouse is up then exit repeat
     put the mouseLoc into newLoc
     put item 1 of newLoc - item 1 of oldLoc into xLoc
     put item 2 of newLoc - item 2 of oldLoc into yLoc
     if abs(xLoc) >= Threshold or abs(yLoc) >= Threshold then
       put hScroll of group "OverlayAndImageGroup" into StartHScroll
       put vScroll of group "OverlayAndImageGroup" into StartVScroll
       put StartHScroll - xLoc into newXScroll
       put StartVScroll - yLoc into newYScroll
       set the lockScreen to true

       #to keep the centering on wanted feature from overscrolling
       if NewXScroll > MaxScrollX then
         set the hscroll of group "OverlayAndImageGroup" to MaxScrollX
       else
         set the hScroll of group "OverlayAndImageGroup" to NewXScroll
       end if
       if newYScroll > MaxScrollY then
         set the vscroll of group "OverlayAndImageGroup" to MaxScrollY
       else
         set the vScroll of group "OverlayAndImageGroup" to NewYScroll
       end if
       set the lockScreen to false
       put newLoc into oldLoc
       if the commandKey is up and the controlKey is up then exit repeat
     end if
   end repeat
end FakeGrabber

-- 
Dr. Christopher D. Condit,  Associate Prof.,  Dept. of Geosciences    
Univ. Massachusetts,  611 North Pleasant St., Amherst, MA, 01003-9297
ccondit at geo.umass.edu  413-545-0272
My Web Page:  http://www.geo.umass.edu/faculty/condit.htm
Revolution Dynamic Digital Maps: http://ddm.geo.umass.edu




More information about the use-livecode mailing list