views:

16

answers:

1
  • Binding a popup menu to an array controller with the path selection.type works fine.
  • Binding a popup menu to a document controller with the path currentDocument.arrayController.selection.type works one way only (changes in selection are not propagated to the popup menu).

How can one achieve inspector-window-like functionality by binding a popup menu to the appropriate array controller depending on the document in focus?

A: 

Are they the same array controller, or is the Inspector window using a separate array controller that happens to be fed by the same array?

Two separate array controllers will have two separate selections. To fix that, give the same object that owns the ultimate array a second property for an NSIndexSet for the selection, and bind both array controllers' selectedIndexes to that property.

It may seem slightly silly to use an NSIndexSet for a pop-up menu's single (not multiple) selection, but array controllers are generic like that.

Peter Hosey
There's only one array controller. (Well. There are as many as there are open documents.) The question is why binding directly to it (thus needing to put the inspector window in the document nib, meh) works, whereas binding to it through a document controller and `currentDocument` doesn't.
andyvn22