In GRAB control

Richmond Mathewson richmondmathewson at gmail.com
Sun Oct 15 13:01:38 EDT 2017


Imagine a stack with a picture of an orange in its centre . . .

The picture: img "arancia", contains the following script:

on mouseDown
       grab me
end mouseDown

so the end-user can move the picture wherever they want
all over the stack.

HOWEVER . . . I want to know whether their initial movement is to the 
left, right, upwards or downwards.

Fantasy time again [pseudocode]:

on Grab
     put the left of me into LEFT1
     put the top of me into TOP1
     wait 2 ticks
put the left of me into LEFT2
     put the top of me into TOP2
      if LEFT2 < LEFT1 then
         put "LEFT"
      else
         put "RIGHT"
      end if
      if TOP2 < TOP1 then
          put "UP"
      else
          put "DOWN"
      end if
end Grab

Richmond.



More information about the use-livecode mailing list