Re: Tuning KVO validation.
Re: Tuning KVO validation.
- Subject: Re: Tuning KVO validation.
- From: Óscar Morales Vivó <email@hidden>
- Date: Wed, 25 Feb 2004 14:19:31 +0100
The problem is the standard NSNumberFormatter doesn't have an option
for validating the number as it's being typed. It would be easy to add
to a derived class but it sounds somewhat redundant. I'll put an
example of what I want...
my text fields must have a number greater or equal than zero and less
than 12 (12 is a no-no).
So we start typing on the field:
- We type a '1', it validates correctly and goes in. Other related
fields are updated.
- We type a '2'. That would make it '12' which is incorrect. So
validation returns 'NO'
Now, what should happen (and I don't know how to make happen) is that
the app should beep and the field get back to displaying a '1' with the
cursor after it.
As it stands now, you just keep typing (although the model doesn't get
updated as it doesn't validate) and it displays a message when you exit
the field by whatever means.
I must be missing a doc on how to deal with validation errors. Or else
Apple is missing it so far.
On 25 Feb 2004, at 13:29, Allan Odgaard wrote:
On 25. Feb 2004, at 13:25, Sscar Morales Vivs wrote:
It seems the only way to get the behaviour I want through use of
NSFormatter would be to subclass NSNumberFormatter and override
either [...]
Have you looked in Interface Builder? If you drag a number formatter
onto a text field or a table column then the info palette for that
view contains an extra page where you can configure the number
formatter (i.e. valid range etc.).
How exactly do you need to verify your numbers?
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.