Tiny Details: Large Double Click Areas To Edit Table Cells
There is a lot of good advice in Wil Shipley’s Monster Marketing talk. One topic that I’m striving for as I work on the successor to Billable is this one (and I’m paraphrasing a bit):
Spend time on the tiny details. This is all your program is, a collection of tiny details. A collection of little moments and if each moment delights the user they will love your software.
So with that said here is a tiny detail…
When implementing an editable NSTableView the default behavior to edit a cell is double click. This behavior is limited however to actually double clicking inside of the rendered text. While this might be appropriate for some, in my own app I want to be a little more forgiving.

To do this simply create a delegate class for the table. Inside of the class setup the awakeFromNib: method to tell the tableView to use itself for the doubleAction.
1 2 3 4 5 | - (void)awakeFromNib { [tableView setDoubleAction:@selector(doubleClickAction:)]; [tableView setTarget:self]; } |
Then define your doubleClickAction:.
1 2 3 4 5 6 7 8 9 10 11 | - (IBAction)doubleClickAction:(id)sender { // make sure they clicked a real cell and not a header or empty row if ([sender clickedRow] != -1 && [sender clickedColumn] != -1) { // edit the cell [sender editColumn:[sender clickedColumn] row:[sender clickedRow] withEvent:nil select:YES]; } } |
Posted on: March 15, 2009 – 1:01 PM

2 Comments
Thanks Mike!
I have been procastinating about fixing this in Checkout for quite a while now, your post finally pushed me over the fence :)
Cheers, - Dirk
@Dirk lol. Glad I could be of service. :)
Post a Comment | Comment RSS feed