Get only Pathname of a dragdropped Object

Mike Bonner bonnmike at gmail.com
Sun Apr 22 06:58:19 EDT 2018


when you set the dragaction, it doesn't actually DO  the action.. All it
really does is a) set the prompt to the action you intend to do, and b)
send that info back to the source of the dragdrop. (not positive about that
second part)

So, if you have a button as the destination for your drag drop, in order to
allow the drop, you need a dragenter handler

on dragenter
   set the dragaction to copy
end dragenter

Then you need a dragdrop for the button also.

on dragdrop
     if the dragdata["files"] is not empty then
         -- this is where you do your processing
         -- dragdata["files"] contains a line delimited list
         -- of the files and folders dropped. (but not the files/folders
themselves)
         -- see a complete example below
     end if
end dragdrop



######################
--Create a stack with a button and a field. Add the following script to the
button.

on dragenter
   set the dragaction to copy
end dragenter

on dragdrop
   if the dragdata["files"] is not empty then -- make sure there is
actually a file/folder dragdrop
      put the dragdata["files"] into tData -- put the file/folder list into
a temporary variable

-- Go through the list and determine whether each line
-- of the data is a folder or if it is a file
      repeat for each line tLine in tData
         if there is a folder tLine then put "Folder: " & tLine & cr after
tList
         if there is a file tLine then put "File: " & tLine & cr after tList
      end repeat
      delete the last char of tList
      sort lines of tList

-- put the list of dropped files and folders into the field
      put tList into field 1
      pass dragdrop
   end if
end dragdrop

On Sun, Apr 22, 2018 at 4:04 AM, Hillen Richard via use-livecode <
use-livecode at lists.runrev.com> wrote:

> Hello list,
>
> I´m looking for a solution to get the path to a Folder by dragdropping it
> into my (macOS)app without that the whole Folder is copied  in the
> drgdrop-process.
>
>
> Is there a solution?
>
>
> Thank you in advance,
> Richard..
>
>
>
> _______________________________________________
> 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