Re: KVO on array values -- member edit can't trigger?
Re: KVO on array values -- member edit can't trigger?
- Subject: Re: KVO on array values -- member edit can't trigger?
- From: Allan Odgaard <email@hidden>
- Date: Sat, 26 Jun 2004 03:47:15 +0200
On 25. Jun 2004, at 22:13, Fritz Anderson wrote:
In StringCat's +initialize method, one says that a change to "parts"
triggers a change to "catenation".
But technically "catenation" is not constructed from "parts", it is
constructed from "parts.stringValue". So that is what it depends upon
(unfortunately dependency relationships cannot be given with key
_paths_, only keys).
What I gather from this is that there is no way to tell the KVO
mechanism that the _content_ of an array member has changed.
That is correct. If this was required, it would mean that even the
application object should "change", because you could view it as a
change to "NSApp.windows.delegate.parts.stringValue" :)
There seems to be no way to express from-many value dependencies like
concatenations.
The NSArrayController is proof-of-concept that you can.
E.g. introduce a new instance variable named "stringParts" and bind it
to "arrayController.arrangedObjects.stringValue". Now set the
"catenation" key to be triggered on changes to "stringParts" (instead
of "parts"), and it should work.
_______________________________________________
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.