Drag and Drop to a Control

Ray ray at linkit.com
Thu Nov 7 01:08:00 EST 2013


Dan,

This may not do exactly what you're looking for but it may give you some 
ideas.  In my case I want my users to always be able to drag files from 
the desktop to stacks they create using my "Tools" stack.  After playing 
around a little, a lot actually, this is the system I found works well.  
It always calls a handler called dragDropFiles in my stack named Tools.

Each time the user's stack is suspended I place a transparent field on 
it, making the field the same size as the stack of course, with this script:

on dragEnter objName
    set the acceptDrop to true
end dragEnter

on dragDrop
    put dragData["files"] into totFilePaths
    send "dragDropFiles "&totFilePaths&"" to stack "Tools" in 15
end dragDrop

In the Tools stack my dragDropFiles handler looks something like this:

on dragDropFiles myFilePaths
    if myFilePaths= "" then put dragData["files"] into myFilePaths
    if myFilePaths= "" then
       exit dragDropFiles
    else wait until the mouse is up
    doDragDropStuff     -- continue to examine and process the dropped 
files here
end dragDropFiles

Each time I return to the stack I delete the transparent field.

Hope this helps,

Ray

On 11/6/2013 8:58 PM, Dan Friedman wrote:
> Ok, I have fiddled around with this most of the day and I am still at square one!   I have a stack as a palette that lists files (each file listed is a group of it's own with an icon, the file name and last update date).  I want to to drag from the palette stack (starting at one of the groups) to another stack and drop to a control (not just the stack).  The control could be a field or an image.  I would like to have a representation of dragging (could be changing the cursor icon or whatever).  But, I want to process what was dropped.  I can't figure it out.
>
> Any advise?
>
> -Dan
> _______________________________________________
> 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