• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Still can't get NSFormatter working....
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Still can't get NSFormatter working....
      • From: Greg Titus <email@hidden>
  • Prev by Date: Attempting to get distinct values from an entity's attribute
  • Next by Date: Re: sticky video/audio files in NSTextView with GC on
  • Previous by thread: RE: Attempting to get distinct values from an entity's attribute
  • Next by thread: Re: Still can't get NSFormatter working....
  • Index(es):
    • Date
    • Thread