aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2009-08-27 07:08:05 +0000
committerBibiko <bibiko@eva.mpg.de>2009-08-27 07:08:05 +0000
commite03c42246d5b1f926842b900688568776c715cdb (patch)
tree67992540cb33759202be4b1887ad58c228bcdfc1
parent68683d597441310bdb92b036171cb7eb436c3563 (diff)
downloadsequelpro-e03c42246d5b1f926842b900688568776c715cdb.tar.gz
sequelpro-e03c42246d5b1f926842b900688568776c715cdb.tar.bz2
sequelpro-e03c42246d5b1f926842b900688568776c715cdb.zip
• improvement for hitting RETURN or ENTER to invoke the row edit mode
- fixed that the table is selectable again - hitting ENTER/RETURN are enabled only for TableContent and ask the delegate's tableView:shouldEditTableColumn: method for validation (by doing so a RETURN/ENTER is the same event as a double-click into a table cell for column 0 if table is in non-editing mode)
-rw-r--r--Source/CMCopyTable.m22
-rw-r--r--Source/SPTableView.m11
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