Discussion:
Dragging file promises
Christiaan Hofman
2012-10-06 11:24:30 UTC
Permalink
I am trying to figure out how to drag file promises from views such as NSTableView. Before 10.6, I knew how to do this using NSFilesPromisePboardType and the namesOfPromisedFilesDroppedAtDestination: delegate methods. The docs now say I should use (NSString *)kPasteboardTypeFileURLPromise instead of NSFilesPromisePboardType. However, I cannot find anything in the docs, no sample code or whatever, that uses this. The only thing in the docs still refers to NSFilesPromisePboardType, or uses dragPromisedFilesOfType:..., which is not appropriate for standard controls such as NSTableView (because that should use this implicitly behind the scenes). Just replacing NSFilesPromisePboardType by kPasteboardTypeFileURLPromise also does not work, the delegate method is never called. So can anyone tell me how I do file promises in 10.6+ using kPasteboardTypeFileURLPromise?

thanks
Christiaan
Fritz Anderson
2012-10-06 19:35:58 UTC
Permalink
Post by Christiaan Hofman
I am trying to figure out how to drag file promises from views such as NSTableView. Before 10.6, I knew how to do this using NSFilesPromisePboardType and the namesOfPromisedFilesDroppedAtDestination: delegate methods.
I'm having trouble getting my head around any of this. For instance, -
namesOfPromisedFilesDroppedAtDestination: isn't a delegate method, but a part of a protocol. And I don't see how NSTableView would know to call dragPromised... "implicitly," given that it never knows that it contains things that could me converted into file promises.

Could you post your code, please?

— F
--
Fritz Anderson -- Xcode 4 Unleashed: 4.5 supplement in the works -- <http://x4u.manoverboard.org/>
Christiaan Hofman
2012-10-06 20:45:45 UTC
Permalink
Post by Fritz Anderson
Post by Christiaan Hofman
I am trying to figure out how to drag file promises from views such as NSTableView. Before 10.6, I knew how to do this using NSFilesPromisePboardType and the namesOfPromisedFilesDroppedAtDestination: delegate methods.
I'm having trouble getting my head around any of this. For instance, -
namesOfPromisedFilesDroppedAtDestination: isn't a delegate method, but a part of a protocol.
A protocol for a delegate (it's not a delegate you set explicitly, but the dragging source is implicitly used as the delegate for the drag operation.) Moreover, a corresponding method is a delegate (or more precisely datasource) method for NSTableView, which is really what it passes through in the end of the drop.
Post by Fritz Anderson
And I don't see how NSTableView would know to call dragPromised... "implicitly," given that it never knows that it contains things that could me converted into file promises.
If you put a NSFilesPromisePboardType on the dragging pasteboard from the NSTableView datasource method tableView:writeRowsWithIndexes:toPasteboard: (remember, I am talking about dragging, and this is how you start a drag from NSTableView), then promised files are dragged automatically, which should go through the view method implicitly (i.e. you don't have to do that yourself, NSTableView does this for you.) And at the drop the namesOfPromisedFiles... method is called.
Post by Fritz Anderson
Could you post your code, please?
— F
It really should not matter that much what the code is. The bottom line from this is that I say that I know how to drag file promises using the old API. And my question is how to drag file promises using the new API and UTIs. I did not go into detail, and really think I shouldn't, because anyone who could answer my question would know what I am talking about, and the code should be straightforward but tedious. So if you don't know what I am talking about, you almost certainly won't be able to answer my question.

Christiaan

Continue reading on narkive:
Loading...