wxRuby Documentation Home

# Wx::TextValidator

TextValidator validates text controls, providing a variety of filtering behaviours.

For more information, please see Validator overview.

## Derived from

Validator

EvtHandler

Object

## See also

Validator overview, Validator,
GenericValidator

## Methods

- TextValidator.new
- TextValidator#clone
- TextValidator#get_excludes
- TextValidator#get_includes
- TextValidator#get_style
- TextValidator#on_char
- TextValidator#set_excludes
- TextValidator#set_includes
- TextValidator#set_style
- TextValidator#transfer_from_window
- TextValidator#transfer_to_window
- TextValidator#validate

### TextValidator.new

TextValidator.new(%(arg-type)TextValidator% validator)

Copy constructor.

TextValidator.new(%(arg-type)Integer% style = FILTER_NONE, String valPtr = nil)

Constructor, taking a style and optional pointer to a String variable.

#### Parameters

- style A bitlist of flags, which can be:

FILTER_NONE | No filtering takes place.
FILTER_ASCII | Non-ASCII characters are filtered out.
FILTER_ALPHA | Non-alpha characters are filtered out.
FILTER_ALPHANUMERIC | Non-alphanumeric characters are filtered out.
FILTER_NUMERIC | Non-numeric characters are filtered out.
FILTER_INCLUDE_LIST | Use an include list. The validatorchecks if the user input is on the list, complaining if not. See TextValidator#set_includes.
FILTER_EXCLUDE_LIST | Use an exclude list. The validatorchecks if the user input is on the list, complaining if it is. See TextValidator#set_excludes.
FILTER_INCLUDE_CHAR_LIST | Use an include list. The validatorchecks if each input character is in the list (one character per list element), complaining if not.See TextValidator#set_includes.
FILTER_EXCLUDE_CHAR_LIST | Use an include list. The validatorchecks if each input character is in the list (one character per list element), complaining if it is.See TextValidator#set_excludes.

- valPtr A pointer to a String variable that contains the value. This variable
  should have a lifetime equal to or longer than the validator lifetime (which is usually
  determined by the lifetime of the window).

### TextValidator#clone

Validator clone()

Clones the text validator using the copy constructor.

### TextValidator#get_excludes

ArrayString get_excludes()

Returns a reference to the exclude list (the list of invalid values).

### TextValidator#get_includes

ArrayString get_includes()

Returns a reference to the include list (the list of valid values).

### TextValidator#get_style

Integer get_style()

Returns the validator style.

### TextValidator#on_char

on_char(%(arg-type)KeyEvent% event)

Receives character input from the window and filters it according to the
current validator style.

### TextValidator#set_excludes

set_excludes(%(arg-type)ArrayString% stringList)

Sets the exclude list (invalid values for the user input).

### TextValidator#set_includes

set_includes(%(arg-type)ArrayString% stringList)

Sets the include list (valid values for the user input).

### TextValidator#set_style

set_style(%(arg-type)Integer% style)

Sets the validator style.

### TextValidator#transfer_from_window

Boolean transfer_from_window()

Transfers the value in the text control to the string.

### TextValidator#transfer_to_window

Boolean transfer_to_window()

Transfers the string value to the text control.

### TextValidator#validate

Boolean validate(%(arg-type)Window% parent)

Validates the window contents against the include or exclude lists, depending
on the validator style.

[This page automatically generated from the Textile source at 2023-06-09 00:45:28 +0000]