I've been fighting with NSTreeController for a couple of days now and have gotten nowhere.
I have a hierarchy of disparate objects. It's pretty simple - Class A has many Class B. That's it. I'd like to display it in an OutlineView. I don't care about adding in additional Class A (Parent) objects, but I do care about adding additional Class B (Child) objects. That's where the headaches start. I've tried overriding NSTreeController's addChild: method, and implementing the same code in an external method in my view's controller. It works, in that it properly adds the right objects to the outlineview, but it adds it into a random spot in the outline view. If I manually re-sort the outline (clicking the column headers), then the rows slide into the appropriate position. So they're being placed in the right spot internally in the collection, the tree controller is just refusing to update the sort order. I've tried calling [myTreeController rearrangeObjects] and even [myTreeController setSortDescriptors:(what I need)] and neither seems to have any effect. I also tried re-wiring everything to use a proxy class which hid all of the entities from the TreeController, with the intent of overriding NSTreeController's newObject method upon creation, but it doesn't appear to be called by addChild:. Yes, I did change the TreeController in Interface Builder to indicate that it was now using a class instead of an Entity. No dice. I was hoping I could do this and just let addChild: operate as it otherwise normally does and hopefully sort correctly and select the selected item, but if newObject isn't being called, I'm stuck. Any suggestions? I either need to get newObject to be called via addChild (which I thought should work. Hopefully I'm missing something obvious), or need to know some way to force the tree controller to re-sort everything into the proper slot, and select the new item. And it all has to run under Tiger, naturally. I'm about to give up. -Jim.... _______________________________________________ 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 arch...@mail-archive.com