Re: Why aren't my bindings firing?
Re: Why aren't my bindings firing?
- Subject: Re: Why aren't my bindings firing?
- From: "Hamish Allan" <email@hidden>
- Date: Mon, 30 Jun 2008 05:30:20 +0100
On Sat, Jun 28, 2008 at 4:17 PM, Charles Srstka
<email@hidden> wrote:
> I wouldn't worry about that too much - everything you said seems to jibe
> perfectly with what views do - the text field's binding *is* called "value"
> and not "stringValue" (that was my bad), and there's no corresponding
> "value" instance method on NSTextView nor any of its superclasses, nor does
> running class-dump on the AppKit turn up a "value" method on any class in
> the AppKit except for _NSControllerKeyValuePair, whatever that is. So in the
> typical case of views, you'd seem to be correct that the bindings represent
> something other than properties, and live in a different namespace.
And if you consider the relationship between the "value" binding and
the "objectValue" property, things get even more odd!
You can programmatically bind to an NSTextField's (and presumably any
other NSControl's) "objectValue" and achieve the same results as
binding to its "value" (either programmatically or through IB).
So you might think that NSControl has a "value" property, and simply
binds it to its own "objectValue" (or vice versa). Except that you
can't call "setValue" (or setValue:whatever forKey:@"value") on an
NSControl, as you would expect to be able to if this were the case.
Perhaps NSControls have their own bind:toObject:withKeyPath:options:
implementation which simply checks for "value" and effectively binds
to "objectValue"? No, classdump confirms that the only
bind:toObject:withKeyPath:options: implementation is that of the
NSKeyValueBindingCreation category of NSObject.
Maybe it's the NSObject implementation itself which handles the
special case? No, you can create an "objectValue" property on your own
classes but you still can't bind to "value" on them (the error message
complains "this class is not key value coding-compliant for the key
value")
It seems really wierd to me that this separate namespace exists,
especially as the AppKit designers could just have exposed the
"objectValue" binding directly rather than this "value" binding which
seems to do exactly the same thing...
Hamish
_______________________________________________
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