aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPTableView.m
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2010-09-16 01:00:12 +0000
committerrowanbeentje <rowan@beent.je>2010-09-16 01:00:12 +0000
commite6497aafda5ecb92e1fe18f5e23999c2babec296 (patch)
tree12effaf3c01389084ba6ba25c2ec1480b662ef9f /Source/SPTableView.m
parentcbb150b07fcb3a96db460a22c4eb5280d8bf9e08 (diff)
downloadsequelpro-e6497aafda5ecb92e1fe18f5e23999c2babec296.tar.gz
sequelpro-e6497aafda5ecb92e1fe18f5e23999c2babec296.tar.bz2
sequelpro-e6497aafda5ecb92e1fe18f5e23999c2babec296.zip
- Consolidate structure and content row editing cancellation code into a single function in each class
- Tweak NSTableView subclasses to catch presses of the Escape key and ask the class to abort row editing. This makes Esc key behaviour much more consistent, and allows cancelling/reverting edits made via the mouse (eg checkboxes, dropdowns, enums), or after the cell editing has finished but the row is still selected. - Remove debug - Update localisable strings
Diffstat (limited to 'Source/SPTableView.m')
-rw-r--r--Source/SPTableView.m8
1 files changed, 7 insertions, 1 deletions
diff --git a/Source/SPTableView.m b/Source/SPTableView.m
index c3f76baf..aa0b5067 100644
--- a/Source/SPTableView.m
+++ b/Source/SPTableView.m
@@ -89,7 +89,7 @@
{
// Check if ENTER or RETURN is hit and edit the column.
- if([self numberOfSelectedRows] == 1 && ([theEvent keyCode] == 36 || [theEvent keyCode] == 76))
+ if ([self numberOfSelectedRows] == 1 && ([theEvent keyCode] == 36 || [theEvent keyCode] == 76))
{
if([[[[self delegate] class] description] isEqualToString:@"SPFieldMapperController"]) {
@@ -126,6 +126,12 @@
}
}
+
+ // Check if ESCAPE is hit and use it to cancel row editing if supported
+ else if ([theEvent keyCode] == 53 && [[self delegate] respondsToSelector:@selector(cancelRowEditing)])
+ {
+ if ([[self delegate] cancelRowEditing]) return;
+ }
[super keyDown:theEvent];