I would like to bind the boolean enabled
property of an NSTextField
to the state of an NSButton
. I already tried adding a custom NSValueTransformer
that transforms the state of the NSButton
into NSNumber
. However, in that scenario the text fields are disabled all the time for some reason. My second approach: To bad fails also since NSValueTransformer
does not offer return primitives types such as BOOL
.
Example:
The screenshot shows an example in which the text fields are disabled because the checkbox has the state NSOnState
. I also would like to bind the labels to this state.
Further, it would be convenient, if I could set a "disabled text" in Interface Builder. In the above example I set the text in the associated class.
Edit:
I set self.anonymousLoginCheckbox.state
as the Model Key Path for the enabled property of the account text field. Similar for the password text field. However, it does not work.
Update:
I created an example project available on GitHub showing the implementation kindly described by Nicolas Bachschmidt.