Re: what's my binding?
Re: what's my binding?
- Subject: Re: what's my binding?
- From: Scott Anguish <email@hidden>
- Date: Sat, 13 Mar 2004 14:56:39 -0500
On Mar 13, 2004, at 12:37 PM, matt neuburg wrote:
"What's my binding?" sounds like a game show.
How do I, a control in the interface, find out programmatically at
runtime
what my bindings are?
When a binding is made to a control/view it gets a
-bind:toObject:withKeyPath:options: and it stores away that information
(specific to this question, the toObject: is what you want).
But there is no API available to query the bindings that are set for
an object.
So, you'd need to actually override bind:toObject:withKeyPath:options:
and then when the appropriate binding is made, you need to sock that
controller information away for yourself so you can use it. And call
the super implementation of course.
> The problem is that calling [self setStringValue:] does *not* update
the
corresponding ivar. Therefore I'm thinking to myself that the right
way to
do this is for the NSTextField to say instead: "Well, what's my
binding?" If
the NSTextField could learn this, it could find out what ivar it is
ultimately tied to, and could call setValue:forKey: to set that ivar
correctly, thus updating *both* the ivar *and* its own displayed string
value.
Yes, this is the correct conceptual way to do it, but you need to do
it as described above.
Is this the right approach, and if so, how do I do it? I can't find any
methods that would lead me from the one thing I know (namely "self")
to the
NSObjectController, its content outlet, and the ivar to which self is
ultimately tied. Or maybe there's a whole different way to do this and
I'm
just not seeing what it is...? Thx - m.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.