On Jun 28, 2008, at 1:30 AM, Charles Srstka wrote:

I guess the only question I still have then is: why did my example worke one-way in the first place? If the bindings are in a different namespace, shouldn't it have failed for lack of an exposed binding named "title" in the Bar object? Or is there a *little* magic going on here, just not going all the way?

That depends on how the bar class from your OP (or one of its superclasses) implemented bind:toObject:withKeyPath:options:. That code may not have checked the passed-in binding name, and may have unconditionally added itself as an observer of ivar_controller for the key path "selection.displayName". That would have guaranteed that bar would receive observeValueForKeyPath:ofObject:change:context: messages whenever foo's displayName property was changed in a KVO-conforming manner. (For example, if, in listing 2 of the how-it-works document, the check of the binding name against "angle" were omitted.)

Then, what happens next is up to bar's implementation of observeValueForKeyPath:ofObject:change:context:. If it blindly did [self setTitle:[object valueForKeyPath:keyPath]], then that would explain it. (For example, if, in listing 4, the test of context were omitted.)

Regards,
ken
_______________________________________________

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