Re: Tracking Focus Between NSOutlineViews
Re: Tracking Focus Between NSOutlineViews
- Subject: Re: Tracking Focus Between NSOutlineViews
- From: Graham Cox <email@hidden>
- Date: Mon, 03 Nov 2014 10:27:55 +1100
On 3 Nov 2014, at 9:50 am, Luther Baker <email@hidden> wrote:
> Now, off to the right side of the window, I have a context DETAIL view that
> displays a few editable fields - depending on the the active selection
> (just like Xcode does with the contextual right hand view).
>
> 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).
There is no change to the selection. What has happened is that there has been a change to the view that has first responder status in the window.
> Is there a best practice convention to "follow" the active selection so I
> can update the contextual view correctly? I am using view based outline
> views -- so I guess I could put mouse handlers on them - or the rows - or
> the cells ... but I'd prefer to use the NSOutlineView tooling (if it
> exists) to track the active selection.
I think this may indicate a problem with your design, if the current first responder makes a difference to your detail view, you're probably Doing It Wrong™. What happens when you tab into one of those detail fields? It becomes first responder itself, so all of your outline views lose focus. If you were tracking this FR status to update your detail view, trying to type into a field would cause that field to disappear.
I would just use the selection indexes of your outline view(s) to set up your detail views and ignore FR state. Tracking FR state can be done but it's actually not that easy, since there are no notifcations you can hook into, though you can KVO observe it. This is likely deliberate to stop people trying to do the sort of thing you think you want here. Your outline view delegates are informed when the selection changes, that's the only information you should be using to determine your detail view content.
--Graham
_______________________________________________
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