Re: Bindings and nested checkboxes and enabled
Re: Bindings and nested checkboxes and enabled
- Subject: Re: Bindings and nested checkboxes and enabled
- From: Andrew Merenbach <email@hidden>
- Date: Sun, 15 Mar 2009 20:52:37 -0700
On Mar 15, 2009, at 8:41 PM, Adam Gerson wrote:
I have two checkboxes in a preferences window which are bound to user
defaults. The second checkbox should only be enabled if the first
checkbox its true. I have this working great with bindings. The second
checkboxe's enabled binding is bound to the value of the first one.
However, if the first checkbox becomes false, the second checkbox goes
unenabled, but remains checked. Is there any way with bindings to get
the second checkbox to reset to false when the first checkbox is
unchecked. I can't bind them both to the same value because there are
cases when the first checkbox would be true and the second one would
be false.
If you need a visual:
http://screencast.com/t/BbQOybP2KjN
Thanks,
Adam
Hi, Adam,
You'll probably want to set up a target-action method to do this,
rather than trying to get a pure-bindings solution. The enabling can
be done with bindings, certainly, but you can the act of resetting
the checked state will likelyrequire a call to -[NSButton setState:]
with a parameter of NSOffState from an IBAction called from the first
checkbox. Hope this helps!
Cheers,
Andrew
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden