Page 1 of 1
drag drop of files and folders
Posted: Tue Apr 08, 2008 7:12 am
by keyless
So Smart Software has a great tutorial on drag and drop. I've learned a lot from this tut and have implimented drag and drop file handeling very well. I've also implimented drag and drop folder handeling in another test program. What I cant figure out, is how to get both working together. Like if a file and folder were both dragged to my program and I wanted to copy the file to one url and the folder to another url.
Posted: Thu Apr 10, 2008 6:42 pm
by keyless
Is there any info out there on using Drag and Drop for Folders.
Does the folder go into the dragdata array just like files do?
Posted: Thu Apr 10, 2008 7:21 pm
by Klaus
Hi keyless,
unfortunately there is nothing like: the dragdata["folders"]
Everything is listed in: the dragdata["files"]
I usually check for files or folders in my handlers like:
Code: Select all
...
repeat for each line i in the dragdata["files"]
if there is a file i then
## do stuff with files...
end if
if there is a folder i then
## do stuff with folders...
end if
end repeat
...
A bit unhandy, but works fine for me
Best
Klaus
Posted: Thu Apr 10, 2008 7:24 pm
by BvG
Test it yourself. Example code for a field:
Code: Select all
on dragDrop
put the dragData["files"] into me
end dragDrop
on mouseEnter
set the acceptDrop to true
end mouseEnter
Posted: Thu Apr 10, 2008 8:57 pm
by keyless
Thanks Klaus, I think the "If there is folder" part of your code will work nicely in a loop that I already have.
@ BvG - Yeah, I already have that part down, the drag drop was never the issue, I just didn't know it was as simple as "If there is a folder", to deal with the folders. The documentation makes it seem the dragData only takes in files.
Thanks for the help.