On 2009 Mar 03, at 18:38, James Walker wrote:

Are these NSOutlineView methods not KVO-friendly, or am I doing something wrong?

I would say the answer to your question is "both" :))

And I also believe that you have two options:

1. Assuming you're using the "classic" dataSource to drive your outline view, you can do what I've done...

* Add your controller as an observer of NSOutlineViewSelectionDidChangeNotification
  * Subclass NSOutlineView
  * Add a dummy instance variable (I use a BOOL) to your NSOutlineView
* When NSOutlineViewSelectionDidChangeNotification is observed, change your
      instance variable (I toggle my BOOL)
* Implement (if Leopard-only) +keyPathsForValuesAffecting<Key>, or if Tiger, use -setKeys:triggerChangeNotificationsForDependentKey:, so that changes in
      your dummy variable will affect/trigger the changes you want.

2. Use NSTreeController. I'm not sure about this because I've never used NSTreeController, but I assume that it provides the observable key paths like you want. I think that providing these observable key paths is one of the purposes of NSArrayController, and I assume that NSTreeController is to NSOutlineView as NSArrayController is to NSTableView. Someone will correct me if I'm wrong...


_______________________________________________

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 arch...@mail-archive.com

Reply via email to