• 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 file promises from an NSOutlineView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Dragging file promises from an NSOutlineView


  • Subject: Dragging file promises from an NSOutlineView
  • From: Mark Alldritt <email@hidden>
  • Date: Sun, 25 Feb 2007 11:45:48 -0800
  • Thread-topic: Dragging file promises from an NSOutlineView

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Dragging file promises from an NSOutlineView
      • From: Dave Fernandes <email@hidden>
  • Prev by Date: Re: Newbie: Dynamically filling NSTableView
  • Next by Date: Re: drawRect problem
  • Previous by thread: Reset toolbars on new release
  • Next by thread: Re: Dragging file promises from an NSOutlineView
  • Index(es):
    • Date
    • Thread