Drag and drop an object

Romain Lafourcade lafourcade.romain at numericable.fr
Sat May 24 16:10:00 EDT 2003


Hi, I'm looking for a way to "drag and drop" an object in my mainstack. I've
written the following piece of code, can anyone tell me if there's an easier
or more elegant way to achieve that ?

local okMouseDown,offsetX,offsetY

on mouseDown
  put the first item of the loc of me - the mouseH into offsetX
  put the second item of the loc of me - the mouseV into offsetY
  put true into okMouseDown
end mouseDown

on mouseMove x,y
   if okMouseDown then set the loc of me to x + offsetX,y + offsetY
end mouseMove

on mouseUp
   put false into okMouseDown
end mouseUp

on mouseRelease
   mouseUp
end mouseRelease

I forgot, I use RR 1.1.1 Starter Kit on Mac OS 9.

Thanks for your advices...
R




More information about the use-livecode mailing list