Paul Forgey
Paul Forgey

Reputation: 11

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.

Upvotes: 0

Views: 112

Answers (1)

Paul Forgey
Paul Forgey

Reputation: 11

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.

Upvotes: 0

Related Questions