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. > #0 -[MyPreferencePane selectionShouldChangeInTableView:] > #1 -[NSTableView _userCanChangeSelection] > #2 -[NSTableView _selectNextFocusedCellGoingForward:andEdit:] > #3 -[NSTableView keyDown:] > #4 -[NSWindow sendEvent:] > #5 -[NSApplication sendEvent:] > #6 ?? > #7 -[NSApplication run] > #8 NSApplicationMain > #9 ?? > > #0 -[MyPreferencePane selectionShouldChangeInTableView:] > #1 -[NSTableView _userCanChangeSelection] > #2 -[NSTableView > _userSelectableRowIndexesForProposedSelection:userCanAlreadyChangeSelection:] > #3 -[NSTableView _userSelectableRowIndexesForProposedSelection:] > #4 -[NSTableView _userCanSelectRow:withNewSelectedIndexes:] > #5 -[NSTableView > _findFirstUserSelectableRowStartingFrom:to:selectedRowsOkay:byExtendingSelecti > on:] > #6 -[NSTableView _selectNextFocusedCellGoingForward:andEdit:] > #7 -[NSTableView keyDown:] > #8 -[NSWindow sendEvent:] > #9 -[NSApplication sendEvent:] > #10 ?? > #11 -[NSApplication run] > #12 NSApplicationMain > #13 ?? > > #0 -[MyPreferencePane tableView:shouldSelectRow:] > #1 -[NSTableView _sendDelegateCanSelectRow:] > #2 -[NSTableView _oldUserCanSelectRow:] > #3 -[NSTableView > _userSelectableRowIndexesForProposedSelection:userCanAlreadyChangeSelection:] > #4 -[NSTableView _userSelectableRowIndexesForProposedSelection:] > #5 -[NSTableView _userCanSelectRow:withNewSelectedIndexes:] > #6 -[NSTableView > _findFirstUserSelectableRowStartingFrom:to:selectedRowsOkay:byExtendingSelecti > on:] > #7 -[NSTableView _selectNextFocusedCellGoingForward:andEdit:] > #8 -[NSTableView keyDown:] > #9 -[NSWindow sendEvent:] > #10 -[NSApplication sendEvent:] > #11 ?? > #12 -[NSApplication run] > #13 NSApplicationMain > #14 ?? > > #0 -[MyPreferencePane tableViewSelectionDidChange:] > #1 _nsnote_callback > #2 __CFXNotificationPost > #3 _CFXNotificationPostNotification > #4 -[NSNotificationCenter postNotificationName:object:userInfo:] > #5 -[NSNotificationCenter postNotificationName:object:] > #6 -[NSTableView _enableSelectionPostingAndPost] > #7 -[NSTableView selectRowIndexes:byExtendingSelection:] > #8 -[NSTableView _selectNextFocusedCellGoingForward:andEdit:] > #9 -[NSTableView keyDown:] > #10 -[NSWindow sendEvent:] > #11 -[NSApplication sendEvent:] > #12 ?? > #13 -[NSApplication run] > #14 NSApplicationMain > #15 ?? > 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. -Grant _______________________________________________ Cocoa-dev mailing list ([email protected]) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
