diff options
-rw-r--r-- | Source/SPCopyTable.m | 1 | ||||
-rw-r--r-- | Source/SPCustomQuery.m | 21 |
2 files changed, 14 insertions, 8 deletions
diff --git a/Source/SPCopyTable.m b/Source/SPCopyTable.m index 2634c7f5..b1b663a4 100644 --- a/Source/SPCopyTable.m +++ b/Source/SPCopyTable.m @@ -120,6 +120,7 @@ NSInteger MENU_EDIT_COPY_AS_SQL = 2003; if ( [self numberOfColumns] - 1 == column) { if([[self delegate] respondsToSelector:@selector(addRowToDB)]) [[self delegate] addRowToDB]; + [[self onMainThread] makeFirstResponder]; } else { // Select the next field for editing [self editColumn:column+1 row:row withEvent:nil select:YES]; diff --git a/Source/SPCustomQuery.m b/Source/SPCustomQuery.m index c9e1f4c5..435cb016 100644 --- a/Source/SPCustomQuery.m +++ b/Source/SPCustomQuery.m @@ -833,14 +833,6 @@ [customQueryView scrollRectToVisible:selectionViewportToRestore]; } - // Restore selection indexes if appropriate - if (selectionIndexToRestore) { - BOOL previousTableRowsSelectable = tableRowsSelectable; - tableRowsSelectable = YES; - [customQueryView selectRowIndexes:selectionIndexToRestore byExtendingSelection:NO]; - tableRowsSelectable = previousTableRowsSelectable; - } - //query finished [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance]; @@ -857,7 +849,14 @@ } [tableDocumentInstance endTask]; + + [customQueryView makeFirstResponder]; + // Restore selection indexes if appropriate + if (selectionIndexToRestore) + [customQueryView selectRowIndexes:selectionIndexToRestore byExtendingSelection:NO]; + [queryRunningPool release]; + } /* @@ -1897,6 +1896,7 @@ [self storeCurrentResultViewForRestoration]; [self performQueries:[NSArray arrayWithObject:lastExecutedQuery] withCallback:NULL]; + } else { // otherwise, just update the data in the data storage SPDataStorageReplaceObjectAtRowAndColumn(resultData, rowIndex, [[aTableColumn identifier] intValue], anObject); @@ -2274,6 +2274,11 @@ if ( editData ) [editData release]; + // Preserve focus and restore selection indexes if appropriate + [customQueryView makeFirstResponder]; + if (selectionIndexToRestore) + [customQueryView selectRowIndexes:selectionIndexToRestore byExtendingSelection:NO]; + return NO; } |