Hi everyone, I'm trying to figure out how file promises work, and I've hit an impasse. Here's what I've got set up:
I have a simple item-based NSBrowser that's displaying my hard drive hierarchy.
When I drag something out of the browser, I'd like to create a simple text
file at the drop location that contains the full path of the item I'm dragging.
Pretty simple; I'm just trying to figure out how this all works before doing
more complex stuff.
In my NSBrowser delegate, I'm doing a simple:
- (BOOL)browser:(NSBrowser *)browser writeRowsWithIndexes:(NSIndexSet
*)rowIndexes inColumn:(NSInteger)column toPasteboard:(NSPasteboard *)pasteboard
{
[pasteboard declareTypes:[NSArray arrayWithObject:(NSString
*)kPasteboardTypeFileURLPromise] owner:self];
[pasteboard setPropertyList:[NSArray arrayWithObject:@"txt"]
forType:(NSString *)kPasteboardTypeFileURLPromise];
return YES;
}
(The idea of including the file extension came from the DragNDropOutlineView
source)
From there, I'm implementing my
"browser:namesOfPromisedFilesDroppedAtDestination:forDraggedRowsWithIndexes:inColumn:"
method, but it's never getting called. When I drag an item from my browser,
it drags and I get the green "+" icon when I drag to the desktop, but when I
release nothing happens. I've tried setting the pasteboard owner to the
browser (instead of the browser datasource), I've tried overriding
respondsToSelector: to figure out if I'm supposed to be implementing anything
else, I've been searching CocoaBuilder, StackOverflow, CocoaDev, Google, sample
code, etc, but I can't find anything to clarify what's supposed to be going on.
Most of the stuff I'm finding is from the pre-Leopard years, or references
stuff like "dragImage:at:offset:event:pasteboard:source:slideBack:" (which
would seem to imply I have to subclass NSBrowser to get this to work?!). The
Drag and Drop programming topics guide in the documentation hasn't been updated
since 2006, and again only talks about the
"dragImage:at:offset:event:pasteboard:source:slideBack:" approach.
In a nutshell, what am I doing wrong, and where is the clear documentation?
Thanks!
Dave DeLong
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Cocoa-dev mailing list ([email protected]) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
