A stricter numeric text validator?

H H at h.com
Fri Aug 17 10:30:38 PDT 2007


In article <46C592C0.7010208 at ceyd.es>, mmartin at ceyd.es (Manuel Martín) 
wrote:

> > wxFormatValidator is not able to check if the entered value is in a 
> > certain range (or I evaluated an old version).
> 
> Yes, range is supported in new version.
> 

Thanks, I will check the newer version.

> > Furthermore, I like to have as a valPtr a pointer to a number type  
> > variable and not a string. It is not difficult to convert the string 
> > into a number type again but it is just additional work. Alternatively 
> > the class should support both types, strings or number types.
> 
> If value comes from a wxTextCtrl, it comes from a string.
> Converting into a number is beyond user input.
> If value is read from a file, socket, etc. you must first
> know how the number is stored (IIEE, string, formatted string,...)
> and then convert it.
> How can you avoid the additional work?
> 

For a couple of applications writing and reading numbers as strings is 
simply too slow. So, you store them in binary format. But as I wrote the 
application I know how I stored them (on all platforms).
Therefore, using the number type instead of a string for the validator 
makes sense.

> If you just need a quick check (not formmated/localized)
> take a look at QCheck in forstnu.cpp from wxFormatValidator.
> 
> HTH
> Manolo
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wx-users-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail: wx-users-help at lists.wxwidgets.org

Hartwig






More information about the wx-users mailing list