This is probably an obvious one but I seem to be missing something.
I'm trying to implement dragging nodes in an NSOutlineView to reorder them. I have what seems to be all the prerequisite methods implemented but writeRows is never being called. When I click and start dragging in the outline view, it simply moves the selection around.
My writeRows function is declared as:
-(BOOL)outlineView:(NSOutlineView *)olv writeRows:(NSArray *)rows toPasteboard:(NSPasteboard *)pboard
and the other functions are:
-(BOOL)outlineView:(NSOutlineView *)olv acceptDrop:(id)info item:(id)targetItem childIndex:(int)childIndex
-(NSDragOperation)outlineView:(NSOutlineView*)olv validateDrop:(id <NSDraggingInfo>)info proposedItem:(id)item proposedChildIndex:(int)index
I've registered a custom pasteboard type in awakeFromNib:
NSString * MyCustomPBoardType = @"SPCustomPBoardType"; ....
// Register for dragging [outlineView registerForDraggedTypes:[NSArray arrayWithObject:MyCustomPBoardType]]; [outlineView setVerticalMotionCanBeginDrag:YES];
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.
Thanks!
|