How to set a field in place with dragenter and a singleclick?

J. Landman Gay jacque at hyperactivesw.com
Mon Dec 19 15:38:08 EST 2005


William de Smet wrote:
 > Thanks for your reply Jacgueline,
 >
 > When I put the "grab" command as the last thing the feld is going
 > nowhere (I can't grab it).
 > The script works for me as well but want I want is a single  mouseclick
 > to unlock the cursor.
 > With this script I need to doubleclick tomake it happen. And that's  to
 > difficult for the children I work with.

After reading your other responses, I see now that you do not want to 
hold down the mouse. I missed that when I first read your message. That 
is why the "grab" command does not work -- "grab" requires that the 
mouse is down.

So instead, try something like this:

local lDragObj

on mouseUp
   if lDragObj = empty then
     put the name of the target into lDragObj
     -- do other things here when object is being dragged
   else
     put empty into lDragObj
     -- do other things here when object is "dropped"
   end if
end mouseUp

on mouseMove x,y
   if lDragObj <> empty then set the loc of lDragObj to x,y
   pass mouseMove
end mouseMove

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com



More information about the use-livecode mailing list