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

Re: basic bindings question


  • Subject: Re: basic bindings question
  • From: Daniel Child <email@hidden>
  • Date: Thu, 15 May 2008 00:43:39 -0400


On May 15, 2008, at 12:09 AM, Ken Thomases wrote:

Can you be more specific about why you want your controller to observe its own number property? What are you trying to accomplish? I suspect there's another way to accomplish what you're interested in.
I'm simply trying to reduce bindings to the most basic case: type into a text field, have that value observed, and then reflect it somewhere else (as in another text field). The actual application I have in mind uses text fields to enable the user to specify sort fields, and rather than have a bunch of methods to check those values prior to sorting, I thought I could use bindings to automatically have those values set as soon as the user types them in. (I've used textDidChange in the past to accomplish something similar, but I thought this would be an easy case to try bindings. Especially since I might want to provide a more elegant interface for specifying sort fields prior to the sort.

In other words, your "myFoo addObserver: self <THE CONTROLLER> forKeyPath: @"number" becomes....

- (void) awakeFromNib {
[self addOberver: self forKeyPath: @"number" options: 0 context: NULL];

There's a typo there. You've missed the "s" in "addObserver".
Oops. Sorry about that, but I get a runtime error all the same:

[<NSApplication 0x119640> valueForUndefinedKey:]: this class is not key value coding-compliant for the key values.
2008-05-15 00:32:19.909 StringBinding[564:10b] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<NSApplication 0x119640> valueForUndefinedKey:]: this class is not key value coding-compliant for the key values.'


Thanks!
_______________________________________________

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: basic bindings question
      • From: Ken Thomases <email@hidden>
References: 
 >basic bindings question (From: Daniel Child <email@hidden>)
 >Re: basic bindings question (From: Ken Thomases <email@hidden>)
 >Re: basic bindings question (From: Daniel Child <email@hidden>)
 >Re: basic bindings question (From: Ken Thomases <email@hidden>)

  • Prev by Date: [ANN] DrawKit beta 3 now available
  • Next by Date: Re: basic bindings question
  • Previous by thread: Re: basic bindings question
  • Next by thread: Re: basic bindings question
  • Index(es):
    • Date
    • Thread