and the answer is... I followed a nice article on how to conditionally repress disclosure triangles for non leaf nodes. T
http://blog.petecallaway.net/?p=15 This part works. The parent node was not expanded so I couldn't see the children. What is strange is this only happens sometimes. I have an BOOL attribute "expanded" in my model. In awakeFromNib I issued a fetchRequest and then check the value for "expanded" and expand the node if it needs to be. So then the questions becomes why is it that sometimes the data is available and my code in awakeFromNib expands the parent, and sometimes it doesn't //fetch items manualy so they are avilible in awakeFromNib NSError *error; [treeController fetchWithRequest:nil merge:NO error:&error]; //Auto expand group items NSUInteger i, count = [outlineView numberOfRows]; for (i = 0; i < count; i++) { NSObject * obj = [[outlineView itemAtRow:i] representedObject]; BOOL isLeaf = [[obj valueForKey:@"isLeaf"] boolValue]; BOOL expanded = [[obj valueForKey:@"expanded"] boolValue]; if (!isLeaf && expanded) { [outlineView expandItem:[outlineView itemAtRow:i]]; NSLog(@"%@",[outlineView itemAtRow:i]); } } According to this tip on Apple's website the fetchRequest should fix this. If I put this code in a method activated by a button it works just fine. "Cannot access contents of an object controller after a nib is loaded Problem: You want to perform an operation with the contents of an object controller (an instance of NSObjectController, NSArrayController, or NSTreeController) after a nib file has been loaded, but the controller's content is nil. Cause: The controller's fetch is executed as a delayed operation performed after its managed object context is set (by nib loading)—the fetch therefore happens after awakeFromNib and windowControllerDidLoadNib:. Remedy: You can execute the fetch "manually" with fetchWithRequest:merge:error:—see "Core Data and Cocoa Bindings." " On Wed, Apr 2, 2008 at 12:42 AM, Adam Gerson <[EMAIL PROTECTED]> wrote: > I have a classic NSTreeController / NSOutlineView situation. The > TreeController has a SortDescriptor on it. I am programatically adding > a leaf node to a group node. It does not appear in the OutlineView > when I first add it. When I inspect the CoreData .xml file the leaf > node is there and it appears to have the right relationships. Then if > I launch the program again there is a 50/50 chance the leaf node will > appear. I just keep launching and quitting the program without making > any changes to the data. Sometimes the child is is the OutlineView and > sometimes it is not. > > With a SortDescriptor applied what other changes could cause the > OutlineView to sometimes show a node and sometimes not on different > launches? > > Thanks, > Adam > _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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]