Re: Dragging file promises from an NSOutlineView
Re: Dragging file promises from an NSOutlineView
- Subject: Re: Dragging file promises from an NSOutlineView
- From: Dave Fernandes <email@hidden>
- Date: Sun, 25 Feb 2007 19:20:04 -0500
I can't claim to be an expert on this, but do you have the following
setup calls somewhere in your code?
[theOutlineView registerForDraggedTypes:myPasteboardTypesArray];
[theOutlineView setDraggingSourceOperationMask:NSDragOperationEvery
forLocal:NO];
Also, has whatever object implements your outlineView delegate
methods below been set as the delegate of the NSOutlineView either in
IB, or programatically?
Does [FSModelHelper writeModels:selection toPasteboard:pboard] return
YES?
On Feb 25, 2007, at 2:45 PM, Mark Alldritt wrote:
Hi All,
Okay, I'm totally stumped on this one. I want to allow the user to
drag
objects from an NSOutlineView to the desktop to export those
objects to a
file.
I've Googled this and nothing that works has surfaced.
This is what I have - this is the code that initiates the drag:
- (BOOL) outlineView:(NSOutlineView*) outlineView writeItems:
(NSArray*)
items toPasteboard:(NSPasteboard*) pboard
{
NSArray* selection = [FSModelHelper normalizeSelection:[items
valueForKey:@"observedObject"]];
if ([FSModelHelper canDuplicateModels:selection])
{
[pboard declareTypes:[NSArray
arrayWithObjects:NSFilesPromisePboardType, nil] owner:self];
[pboard setPropertyList:[NSArray
arrayWithObject:kFSArchiveExtension]
forType:NSFilesPromisePboardType];
return [FSModelHelper writeModels:selection
toPasteboard:pboard];
}
else
return NO;
}
Then, I have these methods to handle the file promise. The problem
is that
these methods are never called and a drop in the Finder's desktop
simply
slides back:
- (NSArray*) namesOfPromisedFilesDroppedAtDestination:(NSURL
*)dropDestination
{
NSLog(@"namesOfPromisedFilesDroppedAtDestination: %@",
dropDestination);
return nil;
}
- (void) pasteboard:(NSPasteboard*) pboard provideDataForType:
(NSString*)
type
{
NSLog(@"pasteboard: %@ provideDataForType: %@", pboard, type);
}
- (NSArray*) outlineView:(NSOutlineView*) outlineView
namesOfPromisedFilesDroppedAtDestination:(NSURL*) dropDestination
forDraggedItems:(NSArray*) items
{
NSArray* selection = [items valueForKey:@"observedObject"];
FSModelHelper* helper = [FSModelHelper modelHelperFor:self
withSelection:selection];
return [NSArray arrayWithObject:[helper
exportAtDropDestination:dropDestination]];
}
FSModelHelper is a class that implements export/import/movement/
deletion
functionality that is shared by several view classes in my
application.
What am I doing wrong?
Cheers
-Mark
----------------------------------------------------------------------
--
Mark Alldritt Late Night Software Ltd.
Phone: 250-380-1725 Script Debugger 4.0 -
AppleScript IDE
WEB: http://www.latenightsw.com/ FaceSpan 4.3 - AppleScript RAD
Affrus 1.0 - Perl Debugging
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
40utoronto.ca
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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