• 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
Re: Why is writeRows not being called in NSOutlineView?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why is writeRows not being called in NSOutlineView?


  • Subject: Re: Why is writeRows not being called in NSOutlineView?
  • From: Steve Palmer <email@hidden>
  • Date: Sat, 18 Jun 2005 11:02:07 -0700

The answer to this was simply tha writeRows is the wrong method. It should be:

-(BOOL)outlineView:(NSOutlineView *)olv writeItems:(NSArray*)items toPasteboard:(NSPasteboard*)pboard

I appear to have completely missed this subtle name shift especially considering that the one section of the Apple documentation on drag and drop seemed to imply the exact implementation shared between NSTableView and NSOutlineView. Oh well.

- Steve


On Jun 6, 2005, at 9:21am, Corbin Dunn wrote:


Unfortunately it doesn't work. What are the possible reasons why writeRows won't be called when initiating a drag in an NSOutlineView? (I've taken a look at the DragNDropOutlineView example which works fine for me but comparing implementations suggests nothing obvious). This is with XCode 2.0 and Tiger, incidentally.


Here's a bit of code that will allow drag and drop in a tableView. It is very basic...but writeRows is called. 

--corbin

NSArray *a = nil;

- (void)awakeFromNib {
    [testTableView registerForDraggedTypes:[NSArray arrayWithObjects:NSStringPboardType, nil]];
}

- (int)numberOfRowsInTableView:(NSTableView *)tableView {
    if (a == nil) {
        a = [NSArray arrayWithObjects:@"hi", @"test", @"another", @"foo", @"Bar", @"tasdfsdf", @"asdflksjf", @"asdfsdf", @"asfds", nil];        
        [a retain];
    }
    return [a count];    
}

- (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row {
    return [a objectAtIndex:row];
}

- (BOOL)tableView:(NSTableView *)tv writeRowsWithIndexes:(NSIndexSet *)rowIndexes toPasteboard:(NSPasteboard*)pboard {
    NSLog(@"write rows");
    return YES;
}

- (NSDragOperation)tableView:(NSTableView*)tv validateDrop:(id <NSDraggingInfo>)info proposedRow:(int)row proposedDropOperation:(NSTableViewDropOperation)op {
    return NSDragOperationCopy | NSDragOperationGeneric;
}

- (BOOL)tableView:(NSTableView*)tv acceptDrop:(id <NSDraggingInfo>)info row:(int)row dropOperation:(NSTableViewDropOperation)op {
    return YES;
}

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Why is writeRows not being called in NSOutlineView? (From: Steve Palmer <email@hidden>)
 >Re: Why is writeRows not being called in NSOutlineView? (From: Corbin Dunn <email@hidden>)

  • Prev by Date: [Moderator] Cocoa and list resources
  • Next by Date: Re: Highly Newbie Question
  • Previous by thread: Re: Why is writeRows not being called in NSOutlineView?
  • Next by thread: Script Phase - Check if we running on 10.4?
  • Index(es):
    • Date
    • Thread