]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/validatr.tex
Minor tweek for WXPM
[wxWidgets.git] / docs / latex / wx / validatr.tex
CommitLineData
a660d684
KB
1\section{\class{wxValidator}}\label{wxvalidator}
2
3wxValidator is the base class for a family of validator classes that mediate
4between a class of control, and application data.
5
6A validator has three major roles:
7
8\begin{enumerate}\itemsep=0pt
9\item to transfer data from a C++ variable or own storage to and from a control;
10\item to validate data in a control, and show an appropriate error message;
11\item to filter events (such as keystrokes), thereby changing the behaviour of the
12associated control.
13\end{enumerate}
14
15Validators can be plugged into controls dynamically.
16
17To specify a default, `null' validator, use the symbol {\bf wxDefaultValidator}.
18
19For more information, please see \helpref{Validator overview}{validatoroverview}.
20
76e1c2de
RD
21\pythonnote{If you wish to create a validator class in wxPython you should
22derive the class from \tt{wxPyValidator} in order to get Python-aware
23capabilities for the various virtual methods.}
24
a660d684
KB
25\wxheading{Derived from}
26
27\helpref{wxEvtHandler}{wxevthandler}\\
28\helpref{wxObject}{wxobject}
29
954b8ae6
JS
30\wxheading{Include files}
31
32<wx/validate.h>
33
a660d684
KB
34\wxheading{See also}
35
76e1c2de 36\helpref{Validator overview}{validatoroverview},
8bb8ab39 37\helpref{wxTextValidator}{wxtextvalidator},
76e1c2de 38\helpref{wxGenericValidator}{wxgenericvalidator},
8bb8ab39 39
a660d684
KB
40
41\latexignore{\rtfignore{\wxheading{Members}}}
42
43\membersection{wxValidator::wxValidator}\label{wxvalidatorconstr}
44
45\func{}{wxValidator}{\void}
46
47Constructor.
48
49\membersection{wxValidator::\destruct{wxValidator}}
50
51\func{}{\destruct{wxValidator}}{\void}
52
53Destructor.
54
55\membersection{wxValidator::Clone}\label{wxvalidatorclone}
56
57\constfunc{virtual wxValidator*}{Clone}{\void}
58
59All validator classes must implement the {\bf Clone} function, which returns
60an identical copy of itself. This is because validators are passed to control
61constructors as references which must be copied. Unlike objects such as pens
62and brushes, it does not make sense to have a reference counting scheme
63to do this cloning, because all validators should have separate
64data.
65
66This base function returns NULL.
67
68\membersection{wxValidator::GetWindow}\label{wxvalidatorgetwindow}
69
70\constfunc{wxWindow*}{GetWindow}{\void}
71
72Returns the window associated with the validator.
73
a994f81b
VZ
74\membersection{wxValidator::SetBellOnError}{wxvalidatorsetbellonerror}
75
76\func{void}{SetBellOnError}{\param{bool}{ doIt = TRUE}}
77
78This functions switches on or turns off the error sound produced by the
79validators if an invalid key is pressed.
80
a660d684
KB
81\membersection{wxValidator::SetWindow}\label{wxvalidatorsetwindow}
82
83\func{void}{SetWindow}{\param{wxWindow*}{ window}}
84
85Associates a window with the validator.
86
87\membersection{wxValidator::TransferFromWindow}\label{wxvalidatortransferfromwindow}
88
76e1c2de 89\func{virtual bool}{TransferToWindow}{}
a660d684
KB
90
91This overridable function is called when the value in the window must be
92transferred to the validator. Return FALSE if there is a problem.
93
94\membersection{wxValidator::TransferToWindow}\label{wxvalidatortransfertowindow}
95
76e1c2de 96\func{virtual bool}{TransferToWindow}{}
a660d684
KB
97
98This overridable function is called when the value associated with the validator must be
99transferred to the window. Return FALSE if there is a problem.
100
101\membersection{wxValidator::Validate}\label{wxvalidatorvalidate}
102
103\func{virtual bool}{Validate}{\param{wxWindow*}{ parent}}
104
105This overridable function is called when the value in the associated window must be validated.
106Return FALSE if the value in the window is not valid; you may pop up an error dialog.
107
108