]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/validatr.tex
Sorry folks, a lot of changes to remedy GetFont, GetBrush etc.
[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
26\wxheading{See also}
27
28\helpref{Validator overview}{validatoroverview}, \helpref{wxTextValidator}{wxtextvalidator}
29
30\latexignore{\rtfignore{\wxheading{Members}}}
31
32\membersection{wxValidator::wxValidator}\label{wxvalidatorconstr}
33
34\func{}{wxValidator}{\void}
35
36Constructor.
37
38\membersection{wxValidator::\destruct{wxValidator}}
39
40\func{}{\destruct{wxValidator}}{\void}
41
42Destructor.
43
44\membersection{wxValidator::Clone}\label{wxvalidatorclone}
45
46\constfunc{virtual wxValidator*}{Clone}{\void}
47
48All validator classes must implement the {\bf Clone} function, which returns
49an identical copy of itself. This is because validators are passed to control
50constructors as references which must be copied. Unlike objects such as pens
51and brushes, it does not make sense to have a reference counting scheme
52to do this cloning, because all validators should have separate
53data.
54
55This base function returns NULL.
56
57\membersection{wxValidator::GetWindow}\label{wxvalidatorgetwindow}
58
59\constfunc{wxWindow*}{GetWindow}{\void}
60
61Returns the window associated with the validator.
62
63\membersection{wxValidator::SetWindow}\label{wxvalidatorsetwindow}
64
65\func{void}{SetWindow}{\param{wxWindow*}{ window}}
66
67Associates a window with the validator.
68
69\membersection{wxValidator::TransferFromWindow}\label{wxvalidatortransferfromwindow}
70
71\func{virtual bool}{TransferToWindow}{\param{wxWindow*}{ parent}}
72
73This overridable function is called when the value in the window must be
74transferred to the validator. Return FALSE if there is a problem.
75
76\membersection{wxValidator::TransferToWindow}\label{wxvalidatortransfertowindow}
77
78\func{virtual bool}{TransferToWindow}{\param{wxWindow*}{ parent}}
79
80This overridable function is called when the value associated with the validator must be
81transferred to the window. Return FALSE if there is a problem.
82
83\membersection{wxValidator::Validate}\label{wxvalidatorvalidate}
84
85\func{virtual bool}{Validate}{\param{wxWindow*}{ parent}}
86
87This overridable function is called when the value in the associated window must be validated.
88Return FALSE if the value in the window is not valid; you may pop up an error dialog.
89
90