NSNumberFormattter not working
NSNumberFormattter not working
- Subject: NSNumberFormattter not working
- From: Ken Tozier <email@hidden>
- Date: Thu, 12 Jul 2007 09:11:38 -0400
Hi
I have a programatically generated NSTextField subclass and am trying
to set it's formatter in the subclass init method but it doesn't seem
to work. I can enter any character (even alphabetic, punctuation etc)
The text field is embedded in another custom view so I created the
following setter method to make setting the format more direct
- (void) setFormatter:(id) inFormatter
{
[textField setFormatter: inFormatter];
}
The actual formatter is set up as a static global in the text field
container class like this
static NSNumberFormatter *gNumberFormatter = nil;
@implementation PMTokenView
+ (void) initialize
{
gNumberFormatter = [[NSNumberFormatter alloc] init];
// constrain input to values between 1 and 1000
[gNumberFormatter setMinimum: [NSNumber numberWithInt: 1]];
[gNumberFormatter setMinimum: [NSNumber numberWithInt: 1000]];
}
- (id) initWithFrame:(NSRect) inRect
{
self = [super initWithFrame: inRect];
if (self)
{
[self setFormatter: gNumberFormatter];
}
return self;
}
@end
Anyone point out what I'm doing wrong?
Thanks for any help
Ken
_______________________________________________
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