Re: outlineViewSelectionDidChange not called
Re: outlineViewSelectionDidChange not called
- Subject: Re: outlineViewSelectionDidChange not called
- From: "Hamish Allan" <email@hidden>
- Date: Thu, 27 Mar 2008 19:07:06 +0000
On Thu, Mar 27, 2008 at 5:17 PM, Adam Gerson <email@hidden> wrote:
> Ok, I understand. So I bind both the OutlineView and the
> TreeController to a third object that keeps them both in sync to the
> same SelectionIndexPath value.
No -- you bind the view to the controller and the controller to the model.
> However, when I tried this my
> OutlineView was blank. I think the Outline Views's selectionIndexPaths
> binding refers to the selectionIndexPaths of its content provider (in
> this case the tree controller). I dont think and outline view has
> selectionIndexPaths properties of its own.
If your outline view is blank there is a problem with your
content/value bindings; this is a separate issue to the selection
index path bindings.
Basically, you need the following bindings (assuming you have
NSMutableArray properties called "content" and "selectionIndexPaths"
in your File's Owner):
(View to Controller bindings:)
NSOutlineView's Content to NSTreeController's arrangedObjects.
NSOutlineView's Selection Index Paths to NSTreeController's selectionIndexPaths
NSTableColumn's Value to NSTreeController's arrangedObjects.nodeName
(Controller to Model bindings:)
NSTreeController's Content Array to File's Owner's content
NSTreeController's Selection Index Paths to File's Owner's selectionIndexPaths
Then, if you need to "update some non controller bound GUI controls
when the selection changes", you need your secondary controller (well,
it's neither model nor view, is it?!) to observe your File's Owner's
selectionIndexPaths (using addObserver:forKeyPath:options:context:)
and update the controls accordingly.
Best wishes,
Hamish
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden