Skip navigation.
 
mlRe: outlineViewSelectionDidChange not called
FROM : Hamish Allan
DATE : Thu Mar 27 20:07:06 2008

On Thu, Mar 27, 2008 at 5:17 PM, Adam Gerson <<email_removed>> 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

Related mailsAuthorDate
mloutlineViewSelectionDidChange not called Adam Gerson Mar 25, 05:18
mlRe: outlineViewSelectionDidChange not called Jens Alfke Mar 25, 05:49
mlRe: outlineViewSelectionDidChange not called Adam Gerson Mar 25, 06:42
mlRe: outlineViewSelectionDidChange not called Jonathan Dann Mar 25, 15:29
mlRe: outlineViewSelectionDidChange not called Adam Gerson Mar 26, 04:12
mlRe: outlineViewSelectionDidChange not called Adam Gerson Mar 26, 04:24
mlRe: outlineViewSelectionDidChange not called Jonathan Dann Mar 26, 20:49
mlRe: outlineViewSelectionDidChange not called Adam Gerson Mar 27, 18:17
mlRe: outlineViewSelectionDidChange not called Hamish Allan Mar 27, 20:07
mlRe: outlineViewSelectionDidChange not called Adam Gerson Mar 30, 09:44
mlRe: outlineViewSelectionDidChange not called Jonathan Dann Mar 31, 22:38