Sunday, 11 August 2013

NSPopupButton contentObject and bindings

NSPopupButton contentObject and bindings

I have a entity StatusCodes which has two attributes, 'number' and 'name'.
I want to be able to set the attribute 'status' in another entity (Task)
to the StatusCode.number.
I have configured the NSPopupButton as follows in IB: - content to
(StatusCodes NSArrayController) arrangedObjects - contentObjects to
(StatusCodes NSArrayController) arrangedObjects with Key Path 'number' -
contentValue to arrangedObjects with Key Path 'name'
And now I have set the binding programmatically as follows: -
selectedObject to (Tasks NSTreeController) selection.status
However nothing seems to be happening ! This all seemed to work fine when
all the bindings were being done in IB.
Have I misunderstood how bindings work - the use of contentObjects was a
bit of a mind bender in the first place.

No comments:

Post a Comment