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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to