Drag and drop promised files to Finder
Drag and drop promised files to Finder
- Subject: Drag and drop promised files to Finder
- From: Renaud Boisjoly <email@hidden>
- Date: Tue, 19 Aug 2003 21:00:03 -0400
Hi all
This topic has been covered to a certain extent, but very few
information was actually disclosed on a solution.
Here is what I need to do:
1. I have an app which has an NSOutline view with pieces of information
2. I can drag and drop theese nodes to my own app to rearrange the
"pages"
3. I can drag and drop to other documents
4. I cannot drag to the Finder
So I'm trying to implement dragPromisedFilesOfTypes in my app, but its
tricky for me.
My NSOutline view uses its dataSource to write its data to the
pasteboard without a problem. I understand that the
dragPromisedFilesOfTypes works by subclassing the NSOutline (I'm
actually extending it, It seems it should work too).
So I can implement dragPromisedFilesOfTypes, but I get conflicts
between the two. I've tried to call it from mouseDown in my
NSOutlineView_extensions, but as soon as I do this, I can no longer
modify the order of my nodes easily. As soon as I click anywhere in the
outline, the file icon appears ready to be dragged. If I was editing
the name of this node, then it stays in edit mode, etc. So the click
doesn't get completed until the drag is done. Pretty ugly.
Now, I'm pretty much a novice programmer, so I may be doing this wrong.
I tried calling [super mouseDown:theEvent] before or after the
dragPromisedFilesOfTypes, but I don't think that's right either, and it
doesn't work anyway.
I was pointed to override - (void)dragImage:(NSImage *)anImage
at:(NSPoint)imageLoc offset:(NSSize)mouseOffset event:(NSEvent
*)theEvent pasteboard:(NSPasteboard *)pboard source:(id)sourceObject
slideBack:(BOOL)slideBack {
and to call [[self dataSource] outlineView:self writeItems:[self
allSelectedItems] toPasteboard:pboard];
to add my own data types to the pasteboard, but the order things happen
is still wrong, I should be able to drag my nodes around freely in the
outline and only when I get over a Finder window should the promised
data be dragged or something...
Buy, this is not as simple as it should be...
Any sample code out there I could look at?
Thanks for any more pointers
Renaud Boisjoly
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.