Handles Content as Compound Value

Bindings in cocoa are un-freaking amazing -- You can change a model parameter and bada-bing-bada-boom the UI updates... Fantastic!

For the most part they just sort of work but I've always been a little confused by all of the options -- Honestly the only one I ever really played with was 'updates continuously' which does what it says (updates happen instantly and it doesn't depend on hitting 'return' or tabbing out of the field.)

The docs are actually here but I've mostly ignored them, until tonight.

Tonight my nemesis was 'Handles Content as Compound Value'

Why? you may ask -- it's perfectly clear what it does.  From the docs:

Handles Content As Compound Value
A Boolean value that determines if the content is treated as a compound value.
Model objects can store relationship-like data in "compound" values and it may be necessary to use a reversible value transformer to translate those compound values temporarily into smaller pieces, that can be displayed and edited individually. See “Bindings Message Flow” in “Cocoa Bindings Programming Topics” for more information.
If YES, the content of a controller is treated as a compound value and—by using a reversible value transformer—will apply changes as a single value to the master model object if anything changes (edits, additions, removals).

 Errrrr.. got that.  What the docs should have said was

Handles Content as Compound Value
Click this if you plan on binding an NSArrayController to a NSUserDefaultsController.

Yup -- That is the magic trick to get it to all work.  If you don't do that many odd things happen but mostly the bindings don't work right.  Apparently (?) the NSUserDefaultsController applies a value transformer for storing the dictionary entries.  Don't ask me why as it's not documented but that appears to be the case.

Just tossing this out for to the googleverse so some person flummoxed why they can't easily bind up their NSArrayController to a NSUserDefaultsController.
Comments (1)

Next Page -->