• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
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?


  • 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.


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

  • Prev by Date: One for the Unix gurus
  • Next by Date: Re: One for the Unix gurus
  • Previous by thread: KVO on array values -- member edit can't trigger?
  • Next by thread: Custom View usage in Interface Builder
  • Index(es):
    • Date
    • Thread