• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Bindings and nested checkboxes and enabled
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Bindings and nested checkboxes and enabled (From: Adam Gerson <email@hidden>)

  • Prev by Date: Re: Messages between Threads
  • Next by Date: Re: KVO notification not properly propagated isuse
  • Previous by thread: Bindings and nested checkboxes and enabled
  • Next by thread: Re: Bindings and nested checkboxes and enabled
  • Index(es):
    • Date
    • Thread