Re: Bindings: NSTreeController sends redundant "selection" keypath KVO notifications
Re: Bindings: NSTreeController sends redundant "selection" keypath KVO notifications
- Subject: Re: Bindings: NSTreeController sends redundant "selection" keypath KVO notifications
- From: "Hamish Allan" <email@hidden>
- Date: Sat, 21 Jun 2008 01:40:01 +0100
On Fri, Jun 20, 2008 at 1:00 PM, Milen Dzhumerov <email@hidden> wrote:
> I'm building a 3-pane interface and I have a NSTreeController managing the
> sidebar. My actual content displayed in the main view is bound to the
> "selection" of the tree controller. When I insert a new object into the tree
> controller (I've disabled selection of inserted objects), I can see the new
> object added and the controller also preserves the selection visually. But
> it actually sends a KVO that selection changed - but it has not (even
> logging the selection object returns the same _NSControllerObjectProxy
> instance).
I think that NSTreeController (and NSArrayController and
NSObjectController) send a notification for pretty much everything
that can change any time anything changes... and rely their observers
to actually work out if anything really did change. And even more
annoyingly, the proper change dictionaries are not included with these
notifications.
> The problem is that when selection changes, my main view
> interpolates / animates it's new state - so it fades-in and fades-out
> without changing its appearance. Is there a way to tell the controller not
> to send KVO notifications when the selection has not actually changed?
> Otherwise I would have to keep a flag in the main view whether any changes
> are real or just redundant.
I'm afraid that's about the size of it. Note that in Leopard, you can
register for NSKeyValueObservingOptionPrior which makes this easier
(you'd want to observe selectionIndexPath or something because, as you
noted, the "selection" object is just a proxy that never changes).
Hamish
_______________________________________________
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