## wxGenericValidator

wxGenericValidator performs data transfer (but not validation or filtering) for the following basic controls: wxButton, wxCheckBox, wxListBox, wxStaticText, wxRadioButton, wxRadioBox, wxChoice, wxComboBox, wxGauge, wxSlider, wxScrollBar, wxSpinButton, wxTextCtrl, wxCheckListBox.

It checks the type of the window and uses an appropriate type for that window. For example, wxButton and wxTextCtrl transfer data to and from a wxString variable; wxListBox uses a wxArrayInt; wxCheckBox uses a bool.

For more information, please see Validator overview.

Derived from

wxValidator
wxEvtHandler
wxObject

Include files

<wx/valgen.h>

See also

Validator overview, wxValidator, wxTextValidator

Members

wxGenericValidator::wxGenericValidator
wxGenericValidator::~wxGenericValidator
wxGenericValidator::Clone
wxGenericValidator::TransferFromWindow
wxGenericValidator::TransferToWindow

### wxGenericValidator::wxGenericValidator

wxGenericValidator(const wxGenericValidator& validator)

Copy constructor.

wxGenericValidator(bool* valPtr)

Constructor taking a bool pointer. This will be used for wxCheckBox and wxRadioButton.

wxGenericValidator(wxString* valPtr)

Constructor taking a wxString pointer. This will be used for wxButton, wxComboBox, wxStaticText, wxTextCtrl.

wxGenericValidator(int* valPtr)

Constructor taking an integer pointer. This will be used for wxGauge, wxScrollBar, wxRadioBox, wxSpinButton, wxChoice.

wxGenericValidator(wxArrayInt* valPtr)

Constructor taking a wxArrayInt pointer. This will be used for wxListBox, wxCheckListBox.

Parameters

validator

Validator to copy.

valPtr

A pointer to a 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).

### wxGenericValidator::~wxGenericValidator

~wxGenericValidator()

Destructor.

### wxGenericValidator::Clone

virtual wxValidator* Clone() const

Clones the generic validator using the copy constructor.

### wxGenericValidator::TransferFromWindow

virtual bool TransferFromWindow()

Transfers the value from the window to the appropriate data type.

### wxGenericValidator::TransferToWindow

virtual bool TransferToWindow()

Transfers the value to the window.