Version: 3.2.5
valtext.h File Reference

Classes

class  wxTextValidator
 wxTextValidator validates text controls, providing a variety of filtering behaviours. More...
 

Enumerations

enum  wxTextValidatorStyle {
  wxFILTER_NONE ,
  wxFILTER_EMPTY ,
  wxFILTER_ASCII ,
  wxFILTER_ALPHA ,
  wxFILTER_ALPHANUMERIC ,
  wxFILTER_DIGITS ,
  wxFILTER_NUMERIC ,
  wxFILTER_INCLUDE_LIST ,
  wxFILTER_INCLUDE_CHAR_LIST ,
  wxFILTER_EXCLUDE_LIST ,
  wxFILTER_EXCLUDE_CHAR_LIST ,
  wxFILTER_XDIGITS ,
  wxFILTER_SPACE
}
 Styles used by wxTextValidator. More...
 

Enumeration Type Documentation

◆ wxTextValidatorStyle

Styles used by wxTextValidator.

Notice that wxFILTER_EXCLUDE[_CHAR]_LIST pair can be used to document the purpose of the validator only and are not enforced in the implementation of the wxTextValidator. Therefore, calling the corresponding member functions: wxTextValidator::{SetExcludes,SetCharExcludes}(), is enough to create the desired validator.

Enumerator
wxFILTER_NONE 

No filtering takes place.

wxFILTER_EMPTY 

Empty strings are filtered out.

If this style is not specified then empty strings are accepted only if they pass the other checks (if you use more than one wxTextValidatorStyle).

wxFILTER_ASCII 

Non-ASCII characters are filtered out. See wxString::IsAscii.

wxFILTER_ALPHA 

Non-alpha characters are filtered out.

Uses the wxWidgets wrapper for the standard CRT function isalpha (which is locale-dependent) on all characters of the string.

wxFILTER_ALPHANUMERIC 

Non-alphanumeric characters are filtered out.

Uses the wxWidgets wrapper for the standard CRT function isalnum (which is locale-dependent) on all characters of the string. Equivalent to wxFILTER_ALPHA combined with wxFILTER_DIGITS or wxFILTER_XDIGITS, or with both of them.

wxFILTER_DIGITS 

Non-digit characters are filtered out.

Uses the wxWidgets wrapper for the standard CRT function isdigit (which is locale-dependent) on all characters of the string.

wxFILTER_NUMERIC 

Non-numeric characters are filtered out.

Works like wxFILTER_DIGITS but allows also decimal points, minus/plus signs and the 'e' or 'E' character to input exponents. Note that this is not the same behaviour of wxString::IsNumber().

wxFILTER_INCLUDE_LIST 

Use an include list.

The validator checks if the user input is on the list, complaining if not. See wxTextValidator::SetIncludes().

wxFILTER_INCLUDE_CHAR_LIST 

Use an include char list.

Characters in the include char list will be allowed to be in the user input. See wxTextValidator::SetCharIncludes(). If this style is set with one or more of the following styles: wxFILTER_ASCII, wxFILTER_ALPHA, wxFILTER_ALPHANUMERIC, wxFILTER_DIGITS, wxFILTER_XDIGITS, wxFILTER_NUMERIC it just extends the character class denoted by the aforementioned styles with those specified in the include char list. If set alone, then the characters allowed to be in the user input are restricted to those, and only those, present in the include char list.

wxFILTER_EXCLUDE_LIST 

Use an exclude list.

The validator checks if the user input is on the list, complaining if it is. See wxTextValidator::SetExcludes().

wxFILTER_EXCLUDE_CHAR_LIST 

Use an exclude char list.

Characters in the exclude char list won't be allowed to be in the user input. See wxTextValidator::SetCharExcludes().

wxFILTER_XDIGITS 

Non-hexadecimal characters are filtered out.

Uses the wxWidgets wrapper for the standard CRT function isxdigit (which is locale-dependent) on all characters of the string.

wxFILTER_SPACE 

A convenience flag for use with the other flags.

The space character is more often used with alphanumeric characters which makes setting a flag more easier than calling SetCharIncludes(" ") for that matter.