Hey, Rick’s tree controller question reminded me that I’ve got one I’ve been meaning to ask:
With an NSOutlineView driven by an NSTreeController, I’m having trouble figuring out how to programmatically select an item: given one of my model objects, how do I tell the controller or view to select it? NSTreeController has a .selectedObjects property, which is great for _getting_ the selection, but for some reason it’s a read-only property (unlike in NSArrayController), so I can’t use it to _set_ the selection. But if I go through the outline view, its ‘item’ objects are the NSTreeNodes managed by the controller, not my model objects, and I don’t see any clean way to map from a model object to its tree node. It seems like I’d have to write a recursive function to search the entire NSTreeNode hierarchy for one whose representedObject is my model object. Surely that can’t be the only way to do this? —Jens _______________________________________________ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com