FROM : Daniel Child
DATE : Thu May 15 06:43:39 2008
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!
DATE : Thu May 15 06:43:39 2008
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!
| Related mails | Author | Date |
|---|---|---|
| Daniel Child | May 14, 21:08 | |
| Ken Thomases | May 14, 23:11 | |
| Daniel Child | May 15, 05:54 | |
| Ken Thomases | May 15, 06:09 | |
| Daniel Child | May 15, 06:43 | |
| Ken Thomases | May 15, 06:54 | |
| Daniel Child | May 16, 04:47 | |
| Ken Thomases | May 16, 05:33 |






Cocoa mail archive

