• 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: checkbox question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: checkbox question


  • Subject: Re: checkbox question
  • From: Quincey Morris <email@hidden>
  • Date: Sat, 22 Aug 2009 19:08:25 -0700

On Aug 22, 2009, at 18:11, Michael de Haan wrote:

OK...that certainly clarifies one thing....so, one **cannot** bind to an object, but to that object's properties? (Hence the error when I tried that).

The error occurred because you bound a binding that requires a numeric value to something that produced a non-numeric value.


If in IB you bind to an object and leave the "model key path" (i.e. the property) blank, it defaults to "self", which is a property of NSObject that returns the object itself. So you can bind to an object, by implicitly or explicitly using its "self" property.

Perhaps I am not using the checkbox correctly, but I wish the label to illustrate that checked represents one type of unit ( eg pounds) and unchecked another ( eg kilograms).

I'd suggest you label the checkbox something like "Use metric system for weights". In addition, you might want to go the trouble of adding a text label that says "lb" or "kg" after each measurement shown in your window.


If you did that, you could add a "measurementUnits" property to your window controller:

+ (NSSet*) keyPathsForValuesAffectingMeasurementUnits
{
	return [NSSet setWithObject: @"state"];
}

- (NSString*) measurementUnits
{
	return state ? @"kg" : "lb";
}

and then bind each of the text labels to that property. Then when you click the checkbox, all the text labels will change automatically.


_______________________________________________

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


  • Follow-Ups:
    • Re: checkbox question
      • From: Michael de Haan <email@hidden>
References: 
 >checkbox question (From: Michael de Haan <email@hidden>)
 >Re: checkbox question (From: Quincey Morris <email@hidden>)
 >Re: checkbox question (From: Michael de Haan <email@hidden>)

  • Prev by Date: Re: NSTextField too slow to update
  • Next by Date: Re: NSTextField too slow to update
  • Previous by thread: Re: checkbox question
  • Next by thread: Re: checkbox question
  • Index(es):
    • Date
    • Thread