diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CMCopyTable.m | 22 | ||||
-rw-r--r-- | Source/SPTableView.m | 11 |
2 files changed, 20 insertions, 13 deletions
diff --git a/Source/CMCopyTable.m b/Source/CMCopyTable.m index 99bff17a..c28a5a3a 100644 --- a/Source/CMCopyTable.m +++ b/Source/CMCopyTable.m @@ -407,9 +407,27 @@ int MENU_EDIT_COPY_AS_SQL = 2002; columnDefinitions = [[NSArray alloc] initWithArray:columnDefs]; } -- (BOOL)acceptsFirstResponder +- (void)keyDown:(NSEvent *)theEvent { - return NO; + + // RETURN or ENTER invoke editing mode for selected row + // by calling tableView:shouldEditTableColumn: to validate + if([[[[self delegate] class] description] isEqualToString:@"TableContent"]) { + + id tableContentView = [[self delegate] valueForKeyPath:@"tableContentView"]; + if([tableContentView numberOfSelectedRows] == 1 && ([theEvent keyCode] == 36 || [theEvent keyCode] == 76)) { + if([[self delegate] tableView:tableContentView shouldEditTableColumn:[[tableContentView tableColumns] objectAtIndex:0] row:[tableContentView selectedRow]]) { + [self editColumn:0 row:[self selectedRow] withEvent:nil select:YES]; + return; + } + } + + } + + [super keyDown:theEvent]; + } + + @end diff --git a/Source/SPTableView.m b/Source/SPTableView.m index f6af2c16..4d97b6bb 100644 --- a/Source/SPTableView.m +++ b/Source/SPTableView.m @@ -59,15 +59,4 @@ return YES; } -- (void)keyDown:(NSEvent *)theEvent -{ - if([self numberOfSelectedRows] == 1 && ([theEvent keyCode] == 36 || [theEvent keyCode] == 76)) - { - [self editColumn:0 row:[self selectedRow] withEvent:nil select:YES]; - } - else { - [super keyDown:theEvent]; - } -} - @end |