Drag and drop files

Hi,

I just look the drag and drop implementation on app in Shane book.
I would like to drag files or folders to app
Seems to be that public.file-url don’t work if you add it in Target_Info area.
I changed to public.item and all works.
http://www.escape.gr/manuals/qdrop/UTI.html
It’s correct?
Is possible to have example about drag and drop (files and folders) over a button or over table?

Ste

Probably. public.url probably also includes non-file URLs.

Drag and drop over a button sounds like a bad idea to me. With a table, do you mean dragging a file from the Finder? If so, this is the minimum you will need:

on applicationWillFinishLaunching_(aNotification)
	my tableView's setDataSource_(me) -- make script the datasource for the table
	my tableView's registerForDraggedTypes_({"public.file-url"})
end applicationWillFinishLaunching_

on tableView_validateDrop_proposedRow_proposedDropOperation_(tv, info, theRow, proposedOp)
	return current application's NSDragOperationLink
end tableView_validateDrop_proposedRow_proposedDropOperation_

on tableView_acceptDrop_row_dropOperation_(tv, info, theRow, proposedOp)
	-- get stuff from pasteboard
	set pb to info's draggingPasteboard()
	set imageURLs to pb's readObjectsForClasses_options_({current application's |NSURL|}, missing value)
	set draggedURL to item 1 of (imageURLs as list)
	set filePath to draggedURL's |path|()
	-- we could check value of proposedOp, to see whether to insert or replace row; let's just insert
	tell arrayController to insertObject_atArrangedObjectIndex_({firstName:filePath, lastName:filePath, isAlumni:false}, theRow)
	return true
end tableView_acceptDrop_row_dropOperation_