I'm trying to implement a source list type of NSOutlineView, where each section 
of the source list has a SourceListSection object. Each SourceListSection 
object has an NSArrayController, filled with a different type of managed object 
from core data. The NSOutlineView is populated through bindings to the 
NSTreeController, whose content is an NSArrayController of SourceListSections.

I use - (NSString *)childrenKeyPathForNode:(NSTreeNode *)node to return 
different children key paths based on the node's representedObject. For the 
SourceListSection I return @"itemsController.arrangedObjects" and for the 
managed objects I return @"children".

- (NSString *)childrenKeyPathForNode:(NSTreeNode *)node
{
        id rep = [node representedObject];
        
        if ([rep isKindOfClass:[SourceListSection class]])
                return @"itemsController.arrangedObjects";

        return @"children";
}


The problem is that when I edit the table entry for a managed object (just a 
name attribute), then valueForKeyPath:@"itemsController.arrangedObjects" is 
sent to the managed objects, where @"children" should be sent instead.

Is the parent's keyPath being wrongly sent to its children in Cocoa, or am I 
misusing childrenKeyPathForNode:? There is very little documentation, blogging, 
of other discussions about childrenKeyPathForNode: that I can find. Perhaps 
because it is not used very much?

Should I avoid using childrenKeyPathForNode:, work around its quirks, or just 
use it correctly (how?) ? Any enlightenment would be appreciated. Thanks.

        john terranova
_______________________________________________

Cocoa-dev mailing list ([email protected])

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to