Drag and Drop

Ray Horsley ray at linkit.com
Thu May 9 08:15:39 EDT 2013


I've never used this feature before and no matter how I set it up it seems kind of sporadic.  The goal is to drag an image file (jpg, jpeg, png, etc.) from the desktop onto a card, get the path to it and ultimately import it into the stack.  I've place an image control on the card which is the same dimensions as the stack itself and scripted the following:

on dragEnter
   set the dragAction to "copy"      -- this is the sporadic part which only sometimes turns the cursor into a plus thus allowing dragDrop to catch the drop
   pass dragEnter
end dragEnter

on dragDrop
   put the dragData into curFilePath
   -- continue to import the file
end dragDrop

This works 'some of the time' but I'm still often unable to drop what I'm dragging since the cursor doesn't always turn into the plus sign.  Each time this happens I try dragging the file again, immediately, and it suddenly works when I didn't change a thing.  What am I missing to get drag/drop working consistently?

Ray Horsley
LinkIt! Software


More information about the use-livecode mailing list