NSOutlineView, Drag-and-Drop, [NSCFArray expandable]: selector not recognized
NSOutlineView, Drag-and-Drop, [NSCFArray expandable]: selector not recognized
- Subject: NSOutlineView, Drag-and-Drop, [NSCFArray expandable]: selector not recognized
- From: "Kirt Cathey" <email@hidden>
- Date: Mon, 22 Aug 2005 22:01:20 +0000
Hi All.
Found a great note in the cocoa-dev archives about setting up an
NSOutlineView for Drag-and-Drop. It's in a posting from a 'Lorenzo' to a
'Johnny Deadman' . This got me most of the way there. Thanks.
However, when I drop onto a node, myOutlineView freezes and an error,
'[NSCFArray expandable]: selector not recognized' shows up in the log.
Here is some of the code:
- (BOOL)outlineView:(NSOutlineView *)outlineView
acceptDrop:(id <NSDraggingInfo>)info item:(id)targetItem
childIndex:(int)childIndex
{
NSPasteboard *pboard = [info draggingPasteboard];
NSArray *myTypes = [NSArray arrayWithObjects:MyItemsPboardType, nil];
if([pboard availableTypeFromArray:myTypes] != nil){
NSData *itemsData = [pboard dataForType:MyItemsPboardType];
/////////////////////// My Code Starts here///////////////////////////////
// row and level for source item declared above in
// - (BOOL)outlineView:(NSOutlineView*)olv writeItems:(NSArray*)items
// toPasteboard:(NSPasteboard*)pboard
// currentLevel
// currentRow
///////////////////////////////////////////////////////////////////////
//targetItem is the parentNode!!!
int destinationLevel = [myOutlineView levelForItem:targetItem];
int destinationRow = childIndex + 1;
// Unarchive source item
Node *sourceItem = [NSKeyedUnarchiver unarchiveObjectWithData:itemsData];
//
if ((currentLevel == 1) && (destinationLevel == 0))
{
Node *replacementNode = [sourceItem copy];
[targetItem insertNode:replacementNode atIndex:destinationRow];
[targetItem removeNodeAtIndex:currentRow];
[myOutlineView reloadData];
}
....
...
...
Thanks in advance for the help!
Regards,
Kirt Cathey
http://www.bizolutions.com
_________________________________________________________________
無料でメールボックス250MBの 「MSN Hotmail」 http://messenger.msn.co.jp/
_______________________________________________
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