• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Dragging an item from my table view onto another app.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Dragging an item from my table view onto another app.
      • From: Eloy Duran <email@hidden>
  • Prev by Date: Re: SSCrypto Framework
  • Next by Date: Re: SSCrypto Framework
  • Previous by thread: Re: Quartz Composer file in IB
  • Next by thread: Re: Dragging an item from my table view onto another app.
  • Index(es):
    • Date
    • Thread