简体   繁体   中英

NSTreeController with editable contents

I've got what (I would think) is an extremely simple case where an NSTreeController is bound to an array of root objects, each of which might have a few child objects. I am using an NSBrowser to show them.

They display fine and the hierarchy is correct.

The problem is the Tree Controller is not making any of the items editable. I want to be able to edit and remove (but not necessarily add) items. canRemove, canEdit always return NO, and the NSBrowser will not edit the labels.

The Tree Controller is marked editable and the count key path is not specified. "Conditionally sets editable" is set in the binding.

I am binding to "Content Array", not "Content", since the root level of items is an array.

Just to eliminate the possibility of mutability being a factor, The array and children are mutable arrays from readwrite properties (for now).

What am I doing wrong? Is binding through an NSTreeController not the right approach here? At this point, it seems easier just to revert to using a data source delegate.

UPDATE: stupid, but probably helpful to people who don't do Cocoa UIs every day (like me), so I'm leaving this question up.

I didn't have the selectionIndex bound between the control and the controller.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM