# wxNumValidator< T > Class Template Reference
[Validators]

`#include <wx/valnum.h>`

Inheritance diagram for wxNumValidator< T >:
[legend]

## Detailed Description

### template<typename T>
class wxNumValidator< T >

wxNumValidator is the common base class for numeric validator classes.

This class is never used directly, but only as a base class for wxIntegerValidator and wxFloatingPointValidator.

Template Parameters:

  | T | Type of the values used with this validator.

Category: Validators

Since:
  2.9.2

## Public Types
typedef T | ValueType
| Type of the values this validator is used with.
## Public Member Functions
void | SetMin (ValueType min)
| Sets the minimal value accepted by the validator.
void | SetMax (ValueType max)
| Sets the maximal value accepted by the validator.
void | SetRange (ValueType min, ValueType max) void SetStyle(int style)
| Sets both minimal and maximal values accepted by the validator.
virtual bool | TransferToWindow ()
| Override base class method to format the control contents.
virtual bool | TransferFromWindow ()
| Override base class method to validate the control contents.

List of all members.

## Member Typedef Documentation

template<typename T>

typedef T wxNumValidator< T >::ValueType

Type of the values this validator is used with.

Reimplemented in wxIntegerValidator< T >, and wxFloatingPointValidator< T >.

## Member Function Documentation

template<typename T>

void wxNumValidator< T >::SetMax | ( | ValueType | max | ) |

Sets the maximal value accepted by the validator.

This value is inclusive, i.e. the value equal to max is accepted.

template<typename T>

void wxNumValidator< T >::SetMin | ( | ValueType | min | ) |

Sets the minimal value accepted by the validator.

This value is inclusive, i.e. the value equal to min is accepted.

template<typename T>

void wxNumValidator< T >::SetRange | ( | ValueType | min,
|  | ValueType | max |
| ) |  |  |

Sets both minimal and maximal values accepted by the validator.

Calling this is equivalent to calling both SetMin() and SetMax(). Change the validator style.

Can be used to change the style of the validator after its creation. The style parameter must be a combination of the values from wxNumValidatorStyle enum.

template<typename T>

virtual bool wxNumValidator< T >::TransferFromWindow | ( |  | ) | `[virtual]`

Override base class method to validate the control contents.

This method is called to check the correctness of user input and fill the associated variable with the controls numeric value. It returns false if it is not a number in the configured range or if the control contents is empty for a validator without wxNUM_VAL_ZERO_AS_BLANK style.

It does nothing if there is no associated variable.

Reimplemented from wxValidator.

template<typename T>

virtual bool wxNumValidator< T >::TransferToWindow | ( |  | ) | `[virtual]`

Override base class method to format the control contents.

This method is called when the associated window is shown and it fills it with the contents of the associated variable, if any, formatted according to the validator style.

It does nothing if there is no associated variable.

Reimplemented from wxValidator.

|  | [ top ]