Still can't get NSFormatter working....
Still can't get NSFormatter working....
- Subject: Still can't get NSFormatter working....
- From: Todd Freese <email@hidden>
- Date: Tue, 17 Feb 2009 09:57:49 -0600
Still can't this NSFormatter to work. It does not seem to be getting
called from my NSTextField.
Here is the formatter:
@implementation FileNameFormatter
- (NSString *)stringForObjectValue:(id)anObject
{
if ([anObject isKindOfClass:[NSString class]]) {
NSString *sourceString = [NSString stringWithString:anObject];
return sourceString;
} else {
return nil;
}
}
- (BOOL)getObjectValue:(id *)obj forString:(NSString *)aString
errorDescription:(NSString **)error
{
if (aString != NULL) {
*obj = [NSString stringWithString:aString];
return YES;
} else {
return NO;
}
}
- (NSAttributedString *)attributedStringForObjectValue:(id)anObject
withDefaultAttributes:(NSDictionary *)attributes
{
return nil;
}
- (BOOL)isPartialStringValid:(NSString **)partialStringPtr
proposedSelectedRange:(NSRangePointer)proposedSelRangePtr
originalString:(NSString *)origString
originalSelectedRange:(NSRange)origSelRange
errorDescription:(NSString **)error
{
NSLog(@"formatter called");
return NO;
}
@end
And here is how I assign it to the NSTextField:
FileNameFormatter *fileNameFormatter = [[[FileNameFormatter alloc]
init] autorelease];
[nameField setFormatter:fileNameFormatter];
Any ideas?
Todd Freese
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden