Skip navigation.
 
mlBypassing inter-cell navigation for NSButtonCell in NSOutlineView
FROM : Nicholas Riley
DATE : Sun Mar 02 14:42:39 2008

[Resending this as a later email I sent was delivered but this wasn't; 
sorry if you receive a duplicate copy.]

In Leopard, checkboxes in my NSOutlineViews get keyboard focus when I 
press Tab.  I don't want this to happen.

The AppKit release notes <http://developer.apple.com/releasenotes/Cocoa/AppKit.html
> state:

> Tables now support inter-cell navigation as follows:
>
> - Tabbing forward to a table focuses the entire table.
> - Hitting Space will attempt to 'performClick:' on a NSButtonCell in 
> the selected row, if there is only one instance in that row.


So far, so good.

> - Tabbing again focuses the first "focusable" (1) cell, if there is 
> one.


I don't want the NSButtonCell to ever get focus.

> (1) A focusable cell is generally defined as [cell isEnabled] && 
> [cell isSelectable] in a table column that is editable. However, 
> NSTextFieldCells also check if the row is selectable, and 
> tableView:shouldEditTableColumn:row: returns YES (if implemented by 
> the delegate). NSImageCells cannot be focused. NSButtonCells only 
> check if the [cell isEnabled].


Disabling the NSButtonCell is not feasible; I want it to be operable.

I've tried a number of things that don't help, including:

1. [checkBoxColumn setEditable: NO];

2. [checkBoxCell setEditable: NO];

3. [checkBoxCell setRefusesFirstResponder: YES];

4. - (BOOL)outlineView:(NSOutlineView *)ov shouldTrackCell:(NSCell 
*)cell forTableColumn:(NSTableColumn *)column item:(id)item {
    return NO;
}

5. - (BOOL)outlineView:(NSOutlineView *)outlineView 
shouldEditTableColumn:(NSTableColumn *)tableColumn item:(id)item {
    return NO;
}

6. - (BOOL)outlineView:(NSOutlineView *)outlineView 
shouldSelectTableColumn:(NSTableColumn *)tableColumn {
    return NO;
}
(a long shot, certainly)

7. overriding keyDown: in the outline view to intercept Tab, which 
works fine, except...

> - Back tabbing into a table will select the last focusable cell.


and I can't figure out how to stop that from happening.

Help?

--
Nicholas Riley <<email_removed>> | <http://www.uiuc.edu/ph/www/njriley>

Related mailsAuthorDate
mlBypassing inter-cell navigation for NSButtonCell in NSOutlineView Nicholas Riley Mar 2, 13:29
mlBypassing inter-cell navigation for NSButtonCell in NSOutlineView Nicholas Riley Mar 2, 14:42
mlRe: Bypassing inter-cell navigation for NSButtonCell in NSOutlineView Tommy Nordgren Mar 2, 16:24
mlRe: Bypassing inter-cell navigation for NSButtonCell in NSOutlineView Ricky Sharp Mar 2, 20:36
mlRe: Bypassing inter-cell navigation for NSButtonCell in NSOutlineView Rosyna Mar 3, 01:58
mlRe: Bypassing inter-cell navigation for NSButtonCell in NSOutlineView Nicholas Riley Mar 3, 02:42
mlRe: Bypassing inter-cell navigation for NSButtonCell in NSOutlineView Corbin Dunn Mar 3, 18:09