Dragging and dropping multiple files into a datagrid

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
PoLyGLoT
Posts: 105
Joined: Sat Jan 14, 2012 12:37 am

Dragging and dropping multiple files into a datagrid

Post by PoLyGLoT » Tue Oct 24, 2017 12:25 am

Hi all,

I want to drag and drop multiple files into a data grid. These files would come from a folder on the local computer, not from the livecode application itself. I then want those files locations to put put into a column into the datagrid. Any thoughts?

Is it correct to start with "dragEnter"?

Code: Select all

on dragEnter 
set the acceptDrop to true
##put file location into DataGrid column X
end dragEnter

PoLyGLoT
Posts: 105
Joined: Sat Jan 14, 2012 12:37 am

Re: Dragging and dropping multiple files into a datagrid

Post by PoLyGLoT » Tue Oct 24, 2017 2:26 am

Hey y'all,

I figured out how to get the info I want. Now I am just trying to figure out a way to open each file and get some meta data for each file!

But here's the code I used to list all the files on a drag and drop:

Code: Select all

on dragEnter
   set the acceptDrop to true
   repeat for each line theLine in the dragData["files"]
      add 1 to currentLine
      put theLine into myData[currentLine]["File Location"]
   end repeat
   set the dgData of group "DataGrid" to myData
end dragEnter

Post Reply

Return to “Talking LiveCode”