Dragging an item from my table view onto another app.
Dragging an item from my table view onto another app.
- Subject: Dragging an item from my table view onto another app.
- From: Eloy Duran <email@hidden>
- Date: Fri, 20 Jun 2008 19:12:50 +0200
Hi,
I'm still very new to all the DND stuff, so here goes:
I want to be able to drag an item from my table view onto, for
instance a texteditor, and have it open the file that the item
represents.
(Also having it drop on Terminal and inserting the path to the file
would be nice, but that might be something completely different.)
Some stuff I tried in my table view data source is (RubyCocoa code btw):
def tableView_writeRowsWithIndexes_toPasteboard(tableView, rows,
pboard)
pboard.declareTypes_owner([OSX::NSFilenamesPboardType], self)
pboard.setPropertyList_forType(['/etc/hosts'],
OSX::NSFilenamesPboardType)
true
end
OR:
def tableView_writeRowsWithIndexes_toPasteboard(tableView, rows,
pboard)
url = OSX::NSURL.URLWithString("/etc/hosts")
pboard.addTypes_owner([OSX::NSURLPboardType], nil)
url.writeToPasteboard pboard
true
end
So the drag operation is initiated, but that's only because I return
true.
Most stuff I read about dragging from the tableview is about promising
files,
which, if I understand it correctly, is not what I need.
Does anyone know where in the docs I should RTFM?
Or a OSS app or example that implements such behaviour?
Kind regards,
Eloy
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden