Drag and Drop

Richard Gaskin ambassador at fourthworld.com
Tue Feb 8 09:56:16 EST 2011

Peter Haworth wrote:

 > I guess I should look again at the IDE script and see what it does
 > after a control has been dropped onto a card, I bet that would
 > reveal all!


The Rev IDE drag-and-drop routines were written before the overhaul of 
the drag-and-drop syntax which has since simplified messaging and 
allowed us to set the dragImage and dragImageOffsets.

This quick example shows one way to use the more recent syntax to 
drag-copy and object from one window to another without having to use an 
intermediary translucent stack to simulate the drag image:

go url "http://www.fourthworldlabs.com/rev/drag.rev"

It inserts a frontScript to track the dragMove message, doing the window 
hit testing there, removing the script when the action is done.

The only problem I can find with this approach is that it "snaps back" 
the dragImage to the source, even though the allowDrop has been set to true.

I've seen this anomaly with other drag actions as well - if anyone here 
knows a reliable way to prevent that I'm be most grateful.

  Richard Gaskin
  Fourth World
  LiveCode training and consulting: http://www.fourthworld.com
  Webzine for LiveCode developers: http://www.LiveCodeJournal.com
  LiveCode Journal blog: http://LiveCodejournal.com/blog.irv

More information about the Use-livecode mailing list