aboutsummaryrefslogtreecommitdiffstats
path: root/Source/TableContent.m
diff options
context:
space:
mode:
authoravenjamin <avenjamin@gmail.com>2009-02-27 01:37:27 +0000
committeravenjamin <avenjamin@gmail.com>2009-02-27 01:37:27 +0000
commit51b094e48b68420cd53be08648eab7b671ce1639 (patch)
tree6df11a0bbc1a8528ba43ad05d6f6533e6b37fb7a /Source/TableContent.m
parent10a7c5a32983070158a736e479b2c6200ecd70fd (diff)
downloadsequelpro-51b094e48b68420cd53be08648eab7b671ce1639.tar.gz
sequelpro-51b094e48b68420cd53be08648eab7b671ce1639.tar.bz2
sequelpro-51b094e48b68420cd53be08648eab7b671ce1639.zip
Added length limits to varchar and char fields. Issue #170
Ideally we should add these limits for other field types depending on their length value.
Diffstat (limited to 'Source/TableContent.m')
-rw-r--r--Source/TableContent.m15
1 files changed, 15 insertions, 0 deletions
diff --git a/Source/TableContent.m b/Source/TableContent.m
index 5876141c..fba8a3ed 100644
--- a/Source/TableContent.m
+++ b/Source/TableContent.m
@@ -30,6 +30,7 @@
#import "SPDataCellFormatter.h"
#import "SPTableData.h"
+
@implementation TableContent
- (id)init
@@ -167,6 +168,11 @@
[dataCell setLineBreakMode:NSLineBreakByTruncatingTail];
[dataCell setFormatter:[[SPDataCellFormatter new] autorelease]];
+ // Set field length limit if field is a varchar to match varchar length
+ if ([[columnDefinition objectForKey:@"typegrouping"] isEqualToString:@"string"]) {
+ [[dataCell formatter] setTextLimit:[[columnDefinition objectForKey:@"length"] intValue]];
+ }
+
// Set the data cell font according to the preferences
if ( [prefs boolForKey:@"useMonospacedFonts"] ) {
[dataCell setFont:[NSFont fontWithName:@"Monaco" size:10]];
@@ -1860,6 +1866,15 @@ objectValueForTableColumn:(NSTableColumn *)aTableColumn
#pragma mark -
+- (void)controlTextDidChange:(NSNotification *)aNotification
+{
+ NSString *fieldType;
+ int row, column, i;
+
+ row = [tableContentView editedRow];
+ column = [tableContentView editedColumn];
+}
+
/*
* Trap the enter and escape keys, overriding default behaviour and continuing/ending editing,
* only within the current row.