Drag and Drop
dunbarx at aol.com
dunbarx at aol.com
Mon Feb 7 01:07:25 EST 2011
Just playing a bit. I made two stacks, one with a button in it and one other. I placed this into the button handler:
on mouseUp
repeat until the mouse is down
set the loc of me to the mouseLoc
put the mouseStack && the mouseLoc
end repeat
answer the mouseStack && the mouseLoc
end mouseUp
The mouseStack reported accurately as I dragged the button to the other stack. As Jacques pointed out, you cannot drag an object from one stack to another, so a stack is likely the thing to use so that something remains visible as you travel to the other stack. But the function works, and is key, so this should be feasible.
It would naturally be better with a mouseMove, mouseDown or mouseStillDown handler, so that one smooth operation did the work, just like the IDE tool palette does. But I could not get similar code to work with any of them. The mouseLoc reported faithfully in all, but the mouseStack function only worked with mouseUp. Not sure why, though they all have in common that the mouse is down. Does this make sense?
Craig Newman
-----Original Message-----
From: Peter Haworth <pete at mollysrevenge.com>
To: How to use LiveCode <use-livecode at lists.runrev.com>
Sent: Sun, Feb 6, 2011 10:32 pm
Subject: Re: Drag and Drop
I did find the code to this for various controls in the rev libraries. I guess
I might be able to just copy it and make it work for me somehow.
Pete Haworth
On Feb 6, 2011, at 7:24 PM, J. Landman Gay wrote:
> On 2/6/11 7:21 PM, dunbarx at aol.com wrote:
>> If you know what controls are where, and you must because you made
>> them, named them and placed them on your palette, then can't you just
>> get target info, clone the control, and make it track the mouse until
>> dropped?
>
> You can't drag controls from one stack to another, you can only drag them
around a card. So the trick is to drag a small temporary stack, which appears
under the mouse, to the target stack, then create the control in the target
stack and delete the temp stack.
>
> The temp stack used for dragging in LiveCode probably has its windowshape set
to an image of the selected control, which gives the illusion of dragging the
control itself.
>
> --
> Jacqueline Landman Gay | jacque at hyperactivesw.com
> HyperActive Software | http://www.hyperactivesw.com
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list