Skip navigation.
 
mlRe: Prevent space characters in a NSTextField
FROM : Yann Bizeul
DATE : Mon Nov 22 22:00:24 2004

> 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%20Reference%20Library/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/

Related mailsAuthorDate
mlPrevent space characters in a NSTextField Lorenzo Nov 22, 18:08
mlRe: Prevent space characters in a NSTextField Yann Bizeul Nov 22, 22:00
mlRe: Prevent space characters in a NSTextField Sean McBride Nov 23, 05:34