Re: Tracking Focus Between NSOutlineViews
Re: Tracking Focus Between NSOutlineViews
- Subject: Re: Tracking Focus Between NSOutlineViews
- From: Ken Thomases <email@hidden>
- Date: Sun, 02 Nov 2014 17:22:10 -0600
On Nov 2, 2014, at 4:50 PM, Luther Baker <email@hidden> wrote:
> The outline view delegates fire when a selection changes ... or should
> change -- but they don't say anything if you simply "reselect" an existing
> selection (turning it from GRAY to BLUE).
This is not a selection event. It's a change of the window's firstResponder. The outline view shows its selection in blue when it or one of its descendant views is the first responder of the key window.
> Is there a best practice convention to "follow" the active selection so I
> can update the contextual view correctly?
You follow whether or not the window is key by observing the NSWindowDidBecomeKeyNotification and NSWindowDidResignKeyNotification notifications. If the window delegate implements -windowDidBecomeKey: and/or -windowDidResignKey:, it is made to observe those notifications with those methods automatically.
You can follow a window's firstResponder using key-value observing (KVO).
Regards,
Ken
_______________________________________________
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