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

Eric Chatonet eric.chatonet at sosmartsoftware.com
Mon Dec 19 15:50:22 EST 2005


Hi William,

Here is a variation that, I hope so, will fit your needs:

local lAllowDrag
---------------------------------
on mouseUp
   if lAllowDrag <> empty then
     put empty into lAllowDrag
     unlock cursor
     set the cursor to arrow
   else
     set cursor to 28
     lock cursor
     set the layer of me to 100
     set the dragdata["text"] to the short name of the target
     put the (mouseH - the left of me) & comma & (the mouseV - the  
top of me) into lAllowDrag
   end if
end mouseUp
---------------------------------
on dragMove x,y
   if lAllowDrag is empty then exit dragMove
   set the topLeft of me to (x - item 1 of lAllowDrag) & comma & (y -  
item 2 of lAllowDrag)
end dragMove
---------------------------------
on mouseEnter
   put empty into lAllowDrag
end mouseEnter

Jacque gave you an excellent answer: this one take into account that  
you can click anywhere in the field without forcing its location to  
be set to the mouse location: might appear more natural.

Best Regards from Paris,
Eric Chatonet
------------------------------------------------------------------------ 
----------------------
http://www.sosmartsoftware.com/    eric.chatonet at sosmartsoftware.com/


Le 19 déc. 05 à 21:36, William de Smet a écrit :

> Hi Eric,
>
> Looking forward to your solution!
> As you probably have read I work with disabled children and need to  
> make the ' mouse handling'  as easy as possible.




More information about the use-livecode mailing list