Re: NSTableView Always Undesirably Selects First Row when It Loses Key Focus
Re: NSTableView Always Undesirably Selects First Row when It Loses Key Focus
- Subject: Re: NSTableView Always Undesirably Selects First Row when It Loses Key Focus
- From: Grant Erickson <email@hidden>
- Date: Tue, 27 Oct 2009 10:11:03 -0700
- Thread-topic: NSTableView Always Undesirably Selects First Row when It Loses Key Focus
On 10/26/09 5:08 PM, Grant Erickson wrote:
> On 10/23/09 4:31 PM, Grant Erickson wrote:
>> I have a device list in my preference pane implemented as a NSTableView under
>> 10.5, not unlike the list of network devices in Apple's Network preference
>> pane.
>>
>> Unlike the Network table, in my case there is no mandate that an item (i.e.
>> row) always be selected. However, if there are no rows selected, when I hit
>> the tab key to change the key focus from my table to the preferences search
>> field, the table automatically, yet undesirably, selects the first row.
>>
>> Is this standard, albeit undocumented, NSTableView behavior? If so, what is
>> the best way to prevent this from happening? Is one of the should*Select*
>> delegate methods most appropriate?
>
> It was suggested off-list to set breakpoints on a few of the table delegate
> methods. I get two calls to selectionShouldChangeInTableView, one to
> shouldSelectRow and one to tableViewSelectionDidChange.
>
> The curiosity seems to be why NSTableView keyDown, when receiving <Tab> and
> losing key focus, insists on "selecting the next focused cell" when there is
> no currently focused cell and the overall table is, in fact, losing focus.
>
> FWIW, the NSOutlineView in the Desktop and Screen Saver preference pane
> exhibits this same behavior.
>
> Command-click whatever current saver you have selected to deselect it and then
> hit <Tab> to get to the preference search box. The outline view will
> auto-select whatever saver shows up in the first expanded grouping.
For those following this thread, this behavior does not exist in either
10.4.11 or 10.6.1, so this would appear to be a 10.5.x-specific bug in
NSTableView.
It looks like I will be subclassing NSTableView and working around it.
Regards,
Grant
_______________________________________________
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