I hooked it all up and now the OutlineView displays content, but the
exact same "out of sync issues remain"

The GUI representation of the selected row (which is always correct)
is not noticed by the TreeController under certain rare conditions. A
removal of an item and then an undo for instance.

However, I appreciate your help in furthering my understanding of
bindings. I just think the OutlineView is broken and under certain
circumstances it doesn't know when to notify others that its selection
has changed. It doesn't call it delegate method selectionDidChange
either.

Adam


On Thu, Mar 27, 2008 at 3:07 PM, Hamish Allan <[EMAIL PROTECTED]> wrote:
> On Thu, Mar 27, 2008 at 5:17 PM, Adam Gerson <[EMAIL PROTECTED]> 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 (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 [EMAIL PROTECTED]

Reply via email to