aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPDataCellFormatter.m
diff options
context:
space:
mode:
Diffstat (limited to 'Source/SPDataCellFormatter.m')
-rw-r--r--Source/SPDataCellFormatter.m18
1 files changed, 18 insertions, 0 deletions
diff --git a/Source/SPDataCellFormatter.m b/Source/SPDataCellFormatter.m
index c23fccf5..051a7ac6 100644
--- a/Source/SPDataCellFormatter.m
+++ b/Source/SPDataCellFormatter.m
@@ -26,6 +26,8 @@
@implementation SPDataCellFormatter
+@synthesize textLimit;
+
- (NSString *)stringForObjectValue:(id)anObject
{
@@ -54,4 +56,20 @@
return [[[NSAttributedString alloc] initWithString:[self stringForObjectValue:anObject] attributes:attributes] autorelease];
}
+
+
+- (BOOL)isPartialStringValid:(NSString *)partialString newEditingString:(NSString **)newString errorDescription:(NSString **)error
+{
+ // No limit set
+ if (textLimit == 0)
+ return YES;
+
+ if ([partialString length] > textLimit) {
+ NSBeep();
+ newString = [NSString stringWithCharacters:partialString length:textLimit];
+ }
+
+ return ([partialString length] <= textLimit);
+}
+
@end