Re: recursing bindings?
Re: recursing bindings?
- Subject: Re: recursing bindings?
- From: mmalcolm crawford <email@hidden>
- Date: Thu, 16 Jun 2005 18:28:21 -0700
On Jun 16, 2005, at 3:33 PM, Joshua Scott Emmons wrote:
How do I update the observable object I'm bound to without
causing it to immediately send me an observeValueForKeyPath...
with the value I just sent it?
Umm, don't send the update in your setValue: method?
Fair enough. But I was under the impression that half the point of
bindings is that the the values are updated in both directions. If
objectA.foo is bound to the property bar in objectB, then when foo
is updated, bar gets the value AND when bar is updated, that gets
propagated to foo.
Yes, but it's up to you how you implement it. If you channel
everything through the same point, then you'll get infinite loops.
Another way to avoid this is to check for equality of values. If the
new and old values are the same, then don't update.
That seems to be the way it works with the stock views like
NSTextView, etc. Are you saying that, the reason these views work
this way is because they send out the notification in some
updateForEvent method instead of in the accessor itself?
I don't know how it's implemented internally. There are several
options.
mmalc
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden