Re: binding to number of selected rows in a table
Re: binding to number of selected rows in a table
- Subject: Re: binding to number of selected rows in a table
- From: Jerry Krinock <email@hidden>
- Date: Tue, 3 Mar 2009 22:02:38 -0800
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 (email@hidden)
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:
This email sent to email@hidden