| Version: 3.3.1

Public Member Functions | List of all members
wxGenericValidator Class Reference
Class List by Category » Validators

`#include <wx/valgen.h>`

Inheritance diagram for wxGenericValidator:
[legend]

## Detailed Description

wxGenericValidator performs data transfer (but not validation or filtering) for many type of controls.

wxGenericValidator supports:

- wxButton, wxRadioButton, wxToggleButton, wxBitmapToggleButton, wxSpinButton
- wxCheckBox, wxRadioBox, wxComboBox, wxListBox, wxCheckListBox
- wxGauge, wxSlider, wxScrollBar, wxChoice, wxStaticText
- wxSpinCtrl, wxTextCtrl, wxColourPickerCtrl (since wxWidgets 3.3.0 or later).

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

Since
  3.2.5 A wxLB_SINGLE wxListBox can also use an int. wxColourPickerCtrl support. A 3-state wxCheckBox can use wxCheckBoxState.
  3.3.0 A group of wxRadioButton controls can also be associated with an int.

For more information, please see wxValidator Overview.

##

Library: wxCore
Category: Validators

See also
  wxValidator Overview, wxValidator, wxTextValidator, wxIntegerValidator, wxFloatingPointValidator

## Public Member Functions
| wxGenericValidator (const wxGenericValidator &validator)
| Copy constructor. More...
| wxGenericValidator (bool *valPtr)
| Constructor taking a bool pointer. More...
| wxGenericValidator (wxString *valPtr)
| Constructor taking a wxString pointer. More...
| wxGenericValidator (int *valPtr)
| Constructor taking an integer pointer. More...
| wxGenericValidator (wxArrayInt *valPtr)
| Constructor taking a wxArrayInt pointer. More...
| wxGenericValidator (wxDateTime *valPtr)
| Constructor taking a wxDateTime pointer. More...
| wxGenericValidator (wxFileName *valPtr)
| Constructor taking a wxFileName pointer. More...
| wxGenericValidator (float *valPtr)
| Constructor taking a float pointer. More...
| wxGenericValidator (double *valPtr)
| Constructor taking a double pointer. More...
virtual | ~wxGenericValidator ()
| Destructor. More...
virtual wxObject * | Clone () const
| Clones the generic validator using the copy constructor. More...
virtual bool | TransferFromWindow ()
| Transfers the value from the window to the appropriate data type. More...
virtual bool | TransferToWindow ()
| Transfers the value to the window. More...
Public Member Functions inherited from wxValidator
| wxValidator ()
| Constructor. More...
virtual | ~wxValidator ()
| Destructor. More...
wxWindow * | GetWindow () const
| Returns the window associated with the validator. More...
virtual void | SetWindow (wxWindow *window)
| Associates a window with the validator. More...
virtual bool | Validate (wxWindow *parent)
| This overridable function is called when the value in the associated window must be validated. More...
Public Member Functions inherited from wxEvtHandler
| wxEvtHandler ()
| Constructor. More...
virtual | ~wxEvtHandler ()
| Destructor. More...
virtual void | QueueEvent (wxEvent *event)
| Queue event for a later processing. More...
virtual void | AddPendingEvent (const wxEvent &event)
| Post an event to be processed later. More...
template<typename T , typename T1 , ... >
void | CallAfter (void(T::*method)(T1,...), T1 x1,...)
| Asynchronously call the given method. More...
template<typename T >
void | CallAfter (const T &functor)
| Asynchronously call the given functor. More...
virtual bool | ProcessEvent (wxEvent &event)
| Processes an event, searching event tables and calling zero or more suitable event handler function(s). More...
bool | ProcessEventLocally (wxEvent &event)
| Try to process the event in this handler and all those chained to it. More...
bool | SafelyProcessEvent (wxEvent &event)
| Processes an event by calling ProcessEvent() and handles any exceptions that occur in the process. More...
void | ProcessPendingEvents ()
| Processes the pending events previously queued using QueueEvent() or AddPendingEvent(); you must call this function only if you are sure there are pending events for this handler, otherwise a `wxCHECK` will fail. More...
void | DeletePendingEvents ()
| Deletes all events queued on this event handler using QueueEvent() or AddPendingEvent(). More...
void | Connect (int id, int lastId, wxEventType eventType, wxObjectEventFunction function, wxObject *userData=nullptr, wxEvtHandler *eventSink=nullptr)
| Connects the given function dynamically with the event handler, id and event type. More...
void | Connect (int id, wxEventType eventType, wxObjectEventFunction function, wxObject *userData=nullptr, wxEvtHandler *eventSink=nullptr)
| See the Connect(int, int, wxEventType, wxObjectEventFunction, wxObject*, wxEvtHandler*) overload for more info. More...
void | Connect (wxEventType eventType, wxObjectEventFunction function, wxObject *userData=nullptr, wxEvtHandler *eventSink=nullptr)
| See the Connect(int, int, wxEventType, wxObjectEventFunction, wxObject*, wxEvtHandler*) overload for more info. More...
bool | Disconnect (wxEventType eventType, wxObjectEventFunction function, wxObject *userData=nullptr, wxEvtHandler *eventSink=nullptr)
| Disconnects the given function dynamically from the event handler, using the specified parameters as search criteria and returning true if a matching function has been found and removed. More...
bool | Disconnect (int id=wxID_ANY, wxEventType eventType=wxEVT_NULL, wxObjectEventFunction function=nullptr, wxObject *userData=nullptr, wxEvtHandler *eventSink=nullptr)
| See the Disconnect(wxEventType, wxObjectEventFunction, wxObject*, wxEvtHandler*) overload for more info. More...
bool | Disconnect (int id, int lastId, wxEventType eventType, wxObjectEventFunction function=nullptr, wxObject *userData=nullptr, wxEvtHandler *eventSink=nullptr)
| See the Disconnect(wxEventType, wxObjectEventFunction, wxObject*, wxEvtHandler*) overload for more info. More...
template<typename EventTag , typename Functor >
void | Bind (const EventTag &eventType, Functor functor, int id=wxID_ANY, int lastId=wxID_ANY, wxObject *userData=nullptr)
| Binds the given function, functor or method dynamically with the event. More...
template<typename EventTag , typename Class , typename EventArg , typename EventHandler >
void | Bind (const EventTag &eventType, void(Class::*method)(EventArg &), EventHandler *handler, int id=wxID_ANY, int lastId=wxID_ANY, wxObject *userData=nullptr)
| See the Bind<>(const EventTag&, Functor, int, int, wxObject*) overload for more info. More...
template<typename EventTag , typename Functor >
bool | Unbind (const EventTag &eventType, Functor functor, int id=wxID_ANY, int lastId=wxID_ANY, wxObject *userData=nullptr)
| Unbinds the given function, functor or method dynamically from the event handler, using the specified parameters as search criteria and returning true if a matching function has been found and removed. More...
template<typename EventTag , typename Class , typename EventArg , typename EventHandler >
bool | Unbind (const EventTag &eventType, void(Class::*method)(EventArg &), EventHandler *handler, int id=wxID_ANY, int lastId=wxID_ANY, wxObject *userData=nullptr)
| See the Unbind<>(const EventTag&, Functor, int, int, wxObject*) overload for more info. More...
void * | GetClientData () const
| Returns user-supplied client data. More...
wxClientData * | GetClientObject () const
| Returns a pointer to the user-supplied client data object. More...
void | SetClientData (void *data)
| Sets user-supplied client data. More...
void | SetClientObject (wxClientData *data)
| Set the client data object. More...
bool | GetEvtHandlerEnabled () const
| Returns true if the event handler is enabled, false otherwise. More...
wxEvtHandler * | GetNextHandler () const
| Returns the pointer to the next handler in the chain. More...
wxEvtHandler * | GetPreviousHandler () const
| Returns the pointer to the previous handler in the chain. More...
void | SetEvtHandlerEnabled (bool enabled)
| Enables or disables the event handler. More...
virtual void | SetNextHandler (wxEvtHandler *handler)
| Sets the pointer to the next handler. More...
virtual void | SetPreviousHandler (wxEvtHandler *handler)
| Sets the pointer to the previous handler. More...
void | Unlink ()
| Unlinks this event handler from the chain it's part of (if any); then links the "previous" event handler to the "next" one (so that the chain won't be interrupted). More...
bool | IsUnlinked () const
| Returns true if the next and the previous handler pointers of this event handler instance are nullptr. More...
Public Member Functions inherited from wxObject
| wxObject ()
| Default ctor; initializes to nullptr the internal reference data. More...
| wxObject (const wxObject &other)
| Copy ctor. More...
virtual | ~wxObject ()
| Destructor. More...
virtual wxClassInfo * | GetClassInfo () const
| This virtual function is redefined for every class that requires run-time type information, when using the wxDECLARE_CLASS macro (or similar). More...
wxObjectRefData * | GetRefData () const
| Returns the wxObject::m_refData pointer, i.e. the data referenced by this object. More...
bool | IsKindOf (const wxClassInfo *info) const
| Determines whether this class is a subclass of (or the same class as) the given class. More...
bool | IsSameAs (const wxObject &obj) const
| Returns true if this object has the same data pointer as obj. More...
void | Ref (const wxObject &clone)
| Makes this object refer to the data in clone. More...
void | SetRefData (wxObjectRefData *data)
| Sets the wxObject::m_refData pointer. More...
void | UnRef ()
| Decrements the reference count in the associated data, and if it is zero, deletes the data. More...
void | UnShare ()
| This is the same of AllocExclusive() but this method is public. More...
void | operator delete (void *buf)
| The delete operator is defined for debugging versions of the library only, when the identifier `__WXDEBUG__` is defined. More...
void * | operator new (size_t size, const wxString &filename=nullptr, int lineNum=0)
| The new operator is defined for debugging versions of the library only, when the identifier `__WXDEBUG__` is defined. More...

## Additional Inherited Members
Static Public Member Functions inherited from wxValidator
static void | SuppressBellOnError (bool suppress=true)
| This functions switches on or turns off the error sound produced by the validators if an invalid key is pressed. More...
static bool | IsSilent ()
| Returns if the error sound is currently disabled. More...
Static Public Member Functions inherited from wxEvtHandler
static void | AddFilter (wxEventFilter *filter)
| Add an event filter whose FilterEvent() method will be called for each and every event processed by wxWidgets. More...
static void | RemoveFilter (wxEventFilter *filter)
| Remove a filter previously installed with AddFilter(). More...
Protected Member Functions inherited from wxEvtHandler
virtual bool | TryBefore (wxEvent &event)
| Method called by ProcessEvent() before examining this object event tables. More...
virtual bool | TryAfter (wxEvent &event)
| Method called by ProcessEvent() as last resort. More...
Protected Member Functions inherited from wxObject
void | AllocExclusive ()
| Ensure that this object's data is not shared with any other object. More...
virtual wxObjectRefData * | CreateRefData () const
| Creates a new instance of the wxObjectRefData-derived class specific to this object and returns it. More...
virtual wxObjectRefData * | CloneRefData (const wxObjectRefData *data) const
| Creates a new instance of the wxObjectRefData-derived class specific to this object and initializes it copying data. More...
Protected Attributes inherited from wxObject
wxObjectRefData * | m_refData
| Pointer to an object which is the object's reference-counted data. More...

## Constructor & Destructor Documentation

## ◆ wxGenericValidator() [1/9]

wxGenericValidator::wxGenericValidator | ( | const wxGenericValidator & | validator | ) |

Copy constructor.

Parameters

  validator | Validator to copy.

## ◆ wxGenericValidator() [2/9]

wxGenericValidator::wxGenericValidator | ( | bool * | valPtr | ) |

Constructor taking a bool pointer.

This will be used for wxCheckBox, wxRadioButton, wxToggleButton and wxBitmapToggleButton.

Parameters

  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() [3/9]

wxGenericValidator::wxGenericValidator | ( | wxString * | valPtr | ) |

Constructor taking a wxString pointer.

This will be used for wxButton, wxComboBox, wxStaticText, wxTextCtrl.

Parameters

  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() [4/9]

wxGenericValidator::wxGenericValidator | ( | int * | valPtr | ) |

Constructor taking an integer pointer.

This will be used for wxChoice, wxGauge, wxScrollBar, wxRadioBox, wxSlider, wxSpinButton and wxSpinCtrl.

Parameters

  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() [5/9]

wxGenericValidator::wxGenericValidator | ( | wxArrayInt * | valPtr | ) |

Constructor taking a wxArrayInt pointer.

This will be used for wxListBox, wxCheckListBox, and groups of wxRadioButton.

Parameters

  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() [6/9]

wxGenericValidator::wxGenericValidator | ( | wxDateTime * | valPtr | ) |

Constructor taking a wxDateTime pointer.

This will be used for wxDatePickerCtrl.

Parameters

  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() [7/9]

wxGenericValidator::wxGenericValidator | ( | wxFileName * | valPtr | ) |

Constructor taking a wxFileName pointer.

This will be used for wxTextCtrl.

Parameters

  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).

Since
  2.9.3

## ◆ wxGenericValidator() [8/9]

wxGenericValidator::wxGenericValidator | ( | float * | valPtr | ) |

Constructor taking a float pointer.

This will be used for wxTextCtrl.

Parameters

  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).

Since
  2.9.3

## ◆ wxGenericValidator() [9/9]

wxGenericValidator::wxGenericValidator | ( | double * | valPtr | ) |

Constructor taking a double pointer.

This will be used for wxTextCtrl.

Parameters

  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).

Since
  2.9.3

## ◆ ~wxGenericValidator()

virtual wxGenericValidator::~wxGenericValidator | ( |  | ) |
| virtual

Destructor.

## Member Function Documentation

## ◆ Clone()

virtual wxObject* wxGenericValidator::Clone | ( |  | ) | const
| virtual

Clones the generic validator using the copy constructor.

Reimplemented from wxValidator.

## ◆ TransferFromWindow()

virtual bool wxGenericValidator::TransferFromWindow | ( |  | ) |
| virtual

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

Reimplemented from wxValidator.

## ◆ TransferToWindow()

virtual bool wxGenericValidator::TransferToWindow | ( |  | ) |
| virtual

Transfers the value to the window.

Reimplemented from wxValidator.