# wxIntegerValidator< T > Class Template Reference
[Validators]

`#include </home/work/projects/wx/2.9/wx/interface/wx/valnum.h>`

Inheritance diagram for wxIntegerValidator< T >:
[legend]

## Detailed Description

### template<typename T>
class wxIntegerValidator< T >

Validator for text entries used for integer entry.

This validator can be used with wxTextCtrl or wxComboBox (and potentially any other class implementing wxTextEntry interface) to check that only valid integer values can be entered into them.

This is a template class which can be instantiated for all the integer types (i.e. `short`, `int`, `long` and `long long` if available) as well as their unsigned versions.

By default this validator accepts any integer values in the range appropriate for its type, e.g. `INT_MIN..INT_MAX` for `int` or `0..USHRT_MAX` for `unsigned short`. This range can be restricted further by calling SetMin() and SetMax() or SetRange() methods inherited from the base class.

A simple example of using this class:

            class MyDialog : public wxDialog
            {
            public:
                MyDialog()
                {
                    ...
                    // Allow positive integers and display them with thousands
                    // separators.
                    wxIntegerValidator<unsigned long>
                        val(&m_value, wxNUM_VAL_THOUSANDS_SEPARATOR);

                    // If the variable were of type "long" and not "unsigned long"
                    // we would have needed to call val.SetMin(0) but as it is,
                    // this is not needed.

                    // Associate it with the text control:
                    new wxTextCtrl(this, ..., val);
                }

            private:
                unsigned long m_value;
            };

For more information, please see wxValidator Overview.

##

Library: wxCore
Category: Validators

See also:
  wxValidator Overview, wxValidator, wxGenericValidator, wxTextValidator, wxMakeIntegerValidator()

Since:
  2.9.2

## Public Types

typedef T | ValueType
| Type of the values this validator is used with.

## Public Member Functions

| wxIntegerValidator (ValueType *value=NULL, int style=wxNUM_VAL_DEFAULT)
| Validator constructor.

List of all members.

## Member Typedef Documentation

template<typename T>

typedef T wxIntegerValidator< T >::ValueType

Type of the values this validator is used with.

Reimplemented from wxNumValidator< T >.

## Constructor & Destructor Documentation

template<typename T>

wxIntegerValidator< T >::wxIntegerValidator | ( | ValueType * | value = `NULL`,
|  | int | style = `wxNUM_VAL_DEFAULT` |
| ) |  |  |

Validator constructor.

Parameters:

  | value | A pointer to the variable associated with the validator. If non NULL, this variable should have a lifetime equal to or longer than the validator lifetime (which is usually determined by the lifetime of the window).
  | style | A combination of wxNumValidatorStyle enum values with the exception of wxNUM_VAL_NO_TRAILING_ZEROES which can't be used here.

|  | [ top ]