Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: KVO on array values -- member edit can't trigger?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: KVO on array values -- member edit can't trigger?



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.


References: 
 >KVO on array values -- member edit can't trigger? (From: Fritz Anderson <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.