Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In Sequel Pro we used a different (and in my eyes simpler) method: We implemented <code>control:textView:doCommandBySelector:</code> in the delegate of the TableView. This method is hard to find -- it can be found in the <strong>NSControlTextEditingDelegate Protocol Reference</strong>. (Remember that NSTableView is a subclass of NSControl)</p> <p>Long story short, here's what we came up with (we didn't override left/right arrow keys, as those are used to navigate within the cell. We use Tab to go left/right)</p> <p>Please note that this is just a snippet from the Sequel Pro source code, and does not work as is</p> <pre><code>- (BOOL)control:(NSControl *)control textView:(NSTextView *)textView doCommandBySelector:(SEL)command { NSUInteger row, column; row = [tableView editedRow]; column = [tableView editedColumn]; // Trap down arrow key if ( [textView methodForSelector:command] == [textView methodForSelector:@selector(moveDown:)] ) { NSUInteger newRow = row+1; if (newRow&gt;=numRows) return TRUE; //check if we're already at the end of the list if (column&gt;= numColumns) return TRUE; //the column count could change [tableContentView selectRowIndexes:[NSIndexSet indexSetWithIndex:newRow] byExtendingSelection:NO]; [tableContentView editColumn:column row:newRow withEvent:nil select:YES]; return TRUE; } // Trap up arrow key else if ( [textView methodForSelector:command] == [textView methodForSelector:@selector(moveUp:)] ) { if (row==0) return TRUE; //already at the beginning of the list NSUInteger newRow = row-1; if (newRow&gt;=numRows) return TRUE; if (column&gt;= numColumns) return TRUE; [tableContentView selectRowIndexes:[NSIndexSet indexSetWithIndex:newRow] byExtendingSelection:NO]; [tableContentView editColumn:column row:newRow withEvent:nil select:YES]; return TRUE; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload