Re: formatters and blank values
Re: formatters and blank values
- Subject: Re: formatters and blank values
- From: matt neuburg <email@hidden>
- Date: Mon, 14 Jul 2003 17:53:34 -0700
On Fri, 11 Jul 2003 10:09:15 -0400, David Feldman
<email@hidden> said:
>
I have an application with a number of text fields whose values must be
>
in a restricted range. Apple's formatters seem like the appropriate
>
choice, but they seem to have a problem: If the user erases the value
>
in a field entirely and then immediately (without tabbing out of the
>
field) takes some action that uses the field data, the blank value is
>
used. The only way I can see around this is to write my own formatter
>
routines. Is there a better way?
Begin the "action that uses the field data" by telling the window to set
its firstResponder to the window itself, and capture the result. This
causes the validation to happen, just as if the user had tabbed out of the
field; in effect, *you* are tabbing out of the field. Well then, if the
result is false, the validation failed, so don't proceed. m.
--------
matt neuburg, phd = email@hidden,
http://www.tidbits.com/matt
pantes anthropoi tou eidenai oregontai phusei
Subscribe to TidBITS! It's free and smart.
http://www.tidbits.com/
_______________________________________________
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.