From 27122d036b690c1e3601f219a0aa69d6ce52addf Mon Sep 17 00:00:00 2001 From: Bibiko Date: Sat, 30 Oct 2010 08:28:46 +0000 Subject: =?UTF-8?q?=E2=80=A2=20after=20the=20field=20editor=20sheet=20was?= =?UTF-8?q?=20closed=20enter=20into=20the=20edit=20mode=20of=20the=20curre?= =?UTF-8?q?nt=20table=20cell;=20this=20makes=20it=20rather=20convenient=20?= =?UTF-8?q?to=20navigate=20and=20edit=20cells=20via=20keyboard=20or=20mous?= =?UTF-8?q?e=20for=20each=20mode=20(field=20editor=20or=20incell);=20the?= =?UTF-8?q?=20sheet=20will=20be=20ordered=20out=20if=20user=20tries=20to?= =?UTF-8?q?=20modify=20the=20current=20cell=20if=20set=20or=20blob?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/SPCopyTable.m | 16 +--------------- Source/SPCustomQuery.m | 13 +++++++++++-- Source/SPTableContent.m | 13 +++++++++++-- 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/Source/SPCopyTable.m b/Source/SPCopyTable.m index 21a1bd7f..98dd45aa 100644 --- a/Source/SPCopyTable.m +++ b/Source/SPCopyTable.m @@ -739,21 +739,8 @@ NSInteger MENU_EDIT_COPY_AS_SQL = 2003; // RETURN or ENTER invoke editing mode for selected row // by calling tableView:shouldEditTableColumn: to validate - // TODO: find a better solution HansJB if([self numberOfSelectedRows] == 1 && ([theEvent keyCode] == 36 || [theEvent keyCode] == 76)) { - if([[self delegate] isKindOfClass:[SPCustomQuery class]] || [[self delegate] isKindOfClass:[SPTableContent class]]) { - [self editColumn:0 row:[self selectedRow] withEvent:nil select:YES];; - } else { - for(id item in [self tableColumns]) { - // Run in fieldEditorMode? - if(![[self delegate] tableView:self shouldEditTableColumn:item row:[self selectedRow]]) - ; - else { - [self editColumn:0 row:[self selectedRow] withEvent:nil select:YES]; - break; - } - } - } + [self editColumn:0 row:[self selectedRow] withEvent:nil select:YES]; return; } @@ -763,7 +750,6 @@ NSInteger MENU_EDIT_COPY_AS_SQL = 2003; if ([[self delegate] cancelRowEditing]) return; } - // TODO: find a better solution HansJB else if ([theEvent keyCode] == 48 && ([[self delegate] isKindOfClass:[SPCustomQuery class]] || [[self delegate] isKindOfClass:[SPTableContent class]])) { [self editColumn:0 row:[self selectedRow] withEvent:nil select:YES]; diff --git a/Source/SPCustomQuery.m b/Source/SPCustomQuery.m index 5eea9f6f..011cdc09 100644 --- a/Source/SPCustomQuery.m +++ b/Source/SPCustomQuery.m @@ -3408,9 +3408,15 @@ - (void)processFieldEditorResult:(id)data contextInfo:(NSDictionary*)contextInfo { + NSInteger row = -1; + NSInteger column = -1; + + if(contextInfo) { + row = [[contextInfo objectForKey:@"row"] integerValue]; + column = [[contextInfo objectForKey:@"column"] integerValue]; + } + if (data && contextInfo) { - NSUInteger row = [[contextInfo objectForKey:@"row"] integerValue]; - NSUInteger column = [[contextInfo objectForKey:@"column"] integerValue]; BOOL isFieldEditable = ([contextInfo objectForKey:@"isFieldEditable"]) ? YES : NO; if(isFieldEditable) { @@ -3428,6 +3434,9 @@ if (selectionIndexToRestore) [customQueryView selectRowIndexes:selectionIndexToRestore byExtendingSelection:NO]; + if(row > -1 && column > -1) + [customQueryView editColumn:column row:row withEvent:nil select:YES]; + } #pragma mark - diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m index c71099b8..19d9a6b6 100644 --- a/Source/SPTableContent.m +++ b/Source/SPTableContent.m @@ -2884,9 +2884,15 @@ - (void)processFieldEditorResult:(id)data contextInfo:(NSDictionary*)contextInfo { + NSInteger row = -1; + NSInteger column = -1; + + if(contextInfo) { + row = [[contextInfo objectForKey:@"row"] integerValue]; + column = [[contextInfo objectForKey:@"column"] integerValue]; + } + if (data && contextInfo) { - NSUInteger row = [[contextInfo objectForKey:@"row"] integerValue]; - NSUInteger column = [[contextInfo objectForKey:@"column"] integerValue]; BOOL isFieldEditable = ([contextInfo objectForKey:@"isFieldEditable"]) ? YES : NO; if (!isEditingRow && [tablesListInstance tableType] != SPTableTypeView) { [oldRow setArray:[tableValues rowContentsAtIndex:row]]; @@ -2918,6 +2924,9 @@ } [[tableDocumentInstance parentWindow] makeFirstResponder:tableContentView]; + + if(row > -1 && column > -1) + [tableContentView editColumn:column row:row withEvent:nil select:YES]; } #pragma mark - -- cgit v1.2.3