Re: Prevent space characters in a NSTextField
Re: Prevent space characters in a NSTextField
- Subject: Re: Prevent space characters in a NSTextField
- From: Yann Bizeul <email@hidden>
- Date: Mon, 22 Nov 2004 22:00:24 +0100
but I would like to totally ignore all the characters different than
numbers
and "." and ",". This way, if the user hit a space or a "x", the field
doesn't get modified at all.
Looks like you want to write your own formatter :-)
Apple provide some two formatters for your convenience, but you can
create your own, and use methods like
- (BOOL)isPartialStringValid:(NSString **)partialStringPtr
proposedSelectedRange:(NSRangePointer)proposedSelRangePtr
originalString:(NSString *)origString
originalSelectedRange:(NSRange)origSelRange errorDescription:(NSString
**)error
are interesting for what you want to do.
See NSFormatter doc for more informations.
file:///Developer/ADC Reference Library/documentation/Cocoa/
Reference/Foundation/ObjC_classic/Classes/NSFormatter.html
--
Yann Bizeul - yann at tynsoe.org
Cocoa Developer, visit my projects at :
http://projects.tynsoe.org/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden