Hello,
In cell-based table views (NSTableView and NSOutlineView), if you had editable text field cells, tabbing out of a text cell would automatically move the focus to the next editable cell. So, say you had a table composed of five rows and three columns. If you were editing row 4, column 2 and hit tab, the cell at row 4, column 3 would gain the focus (presuming it was editable; otherwise the next editable cell would get the focus). If you hit tab again, row 5, column 1 would get the focus. And if the cell at row 5, column 3 was being edited and you hit tab, focus would cycle up to row 1, column 1.
In view-based tables, however, this does not work as expected. In view-based tables, things work as follows:
1. You double-click to start editing a cell - e.g. row 4, column 2.
2. You hit tab and things work as expected to begin with.
3. However, when you reach the last cell in the table and hit tab again, focus returns to the table view and editing ends.
4. If you then hit tab again, the cell you initially double-clicked in step (1) - e.g. row 4, column 2 - starts editing again.
This seems like a very silly bug to me, and I have reported it as such (ID#22576209). Is there a way around this behaviour or something I'm missing, though? View-based tables have been around for a while now, and Mac users tend to like ways of doing things with the keyboard in my experience, so I would have imagined that this would have come up as an issue a lot, but can find very little on it relating to view-based tables.
I have found one way of fixing the issue: I can make the delegate of my table view the delegate of all of my text fields in the table, and I can then override -control:textView:doCommandBySelector: to trap -insertTab: and -insertBacktab: and search for the next or previous editable cell myself. This works fine, but it means that for every table I create (and I have a *lot* of tables and outline views in my rather large app) I have to remember to hook up all of the text fields with a delegate, and I have to add this extra code, which was never necessary with cell-based tables.
Has anyone come across this and found a more straightforward solution? (I thought I might be able to do it in a subclass, but of course, -textView:doCommandBySelector: isn't called on NSTableView for view-based tables.)
Thanks,
Keith