]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/validatr.tex
*** empty log message ***
[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
21\wxheading{Derived from}
22
23\helpref{wxEvtHandler}{wxevthandler}\\
24\helpref{wxObject}{wxobject}
25
954b8ae6
JS
26\wxheading{Include files}
27
28<wx/validate.h>
29
a660d684
KB
30\wxheading{See also}
31
8bb8ab39
SB
32\helpref{Validator overview}{validatoroverview},
33\helpref{wxTextValidator}{wxtextvalidator},
34\helpref{wxTextValidator}{wxgenericvalidator},
35
a660d684
KB
36
37\latexignore{\rtfignore{\wxheading{Members}}}
38
39\membersection{wxValidator::wxValidator}\label{wxvalidatorconstr}
40
41\func{}{wxValidator}{\void}
42
43Constructor.
44
45\membersection{wxValidator::\destruct{wxValidator}}
46
47\func{}{\destruct{wxValidator}}{\void}
48
49Destructor.
50
51\membersection{wxValidator::Clone}\label{wxvalidatorclone}
52
53\constfunc{virtual wxValidator*}{Clone}{\void}
54
55All validator classes must implement the {\bf Clone} function, which returns
56an identical copy of itself. This is because validators are passed to control
57constructors as references which must be copied. Unlike objects such as pens
58and brushes, it does not make sense to have a reference counting scheme
59to do this cloning, because all validators should have separate
60data.
61
62This base function returns NULL.
63
64\membersection{wxValidator::GetWindow}\label{wxvalidatorgetwindow}
65
66\constfunc{wxWindow*}{GetWindow}{\void}
67
68Returns the window associated with the validator.
69
a994f81b
VZ
70\membersection{wxValidator::SetBellOnError}{wxvalidatorsetbellonerror}
71
72\func{void}{SetBellOnError}{\param{bool}{ doIt = TRUE}}
73
74This functions switches on or turns off the error sound produced by the
75validators if an invalid key is pressed.
76
a660d684
KB
77\membersection{wxValidator::SetWindow}\label{wxvalidatorsetwindow}
78
79\func{void}{SetWindow}{\param{wxWindow*}{ window}}
80
81Associates a window with the validator.
82
83\membersection{wxValidator::TransferFromWindow}\label{wxvalidatortransferfromwindow}
84
85\func{virtual bool}{TransferToWindow}{\param{wxWindow*}{ parent}}
86
87This overridable function is called when the value in the window must be
88transferred to the validator. Return FALSE if there is a problem.
89
90\membersection{wxValidator::TransferToWindow}\label{wxvalidatortransfertowindow}
91
92\func{virtual bool}{TransferToWindow}{\param{wxWindow*}{ parent}}
93
94This overridable function is called when the value associated with the validator must be
95transferred to the window. Return FALSE if there is a problem.
96
97\membersection{wxValidator::Validate}\label{wxvalidatorvalidate}
98
99\func{virtual bool}{Validate}{\param{wxWindow*}{ parent}}
100
101This overridable function is called when the value in the associated window must be validated.
102Return FALSE if the value in the window is not valid; you may pop up an error dialog.
103
104