]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/validatr.tex
If somebody ever decides to actually check in fsfile.tex and
[wxWidgets.git] / docs / latex / wx / validatr.tex
1 \section{\class{wxValidator}}\label{wxvalidator}
2
3 wxValidator is the base class for a family of validator classes that mediate
4 between a class of control, and application data.
5
6 A 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
12 associated control.
13 \end{enumerate}
14
15 Validators can be plugged into controls dynamically.
16
17 To specify a default, `null' validator, use the symbol {\bf wxDefaultValidator}.
18
19 For 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{Include files}
27
28 <wx/validate.h>
29
30 \wxheading{See also}
31
32 \helpref{Validator overview}{validatoroverview}, \helpref{wxTextValidator}{wxtextvalidator}
33
34 \latexignore{\rtfignore{\wxheading{Members}}}
35
36 \membersection{wxValidator::wxValidator}\label{wxvalidatorconstr}
37
38 \func{}{wxValidator}{\void}
39
40 Constructor.
41
42 \membersection{wxValidator::\destruct{wxValidator}}
43
44 \func{}{\destruct{wxValidator}}{\void}
45
46 Destructor.
47
48 \membersection{wxValidator::Clone}\label{wxvalidatorclone}
49
50 \constfunc{virtual wxValidator*}{Clone}{\void}
51
52 All validator classes must implement the {\bf Clone} function, which returns
53 an identical copy of itself. This is because validators are passed to control
54 constructors as references which must be copied. Unlike objects such as pens
55 and brushes, it does not make sense to have a reference counting scheme
56 to do this cloning, because all validators should have separate
57 data.
58
59 This base function returns NULL.
60
61 \membersection{wxValidator::GetWindow}\label{wxvalidatorgetwindow}
62
63 \constfunc{wxWindow*}{GetWindow}{\void}
64
65 Returns the window associated with the validator.
66
67 \membersection{wxValidator::SetBellOnError}{wxvalidatorsetbellonerror}
68
69 \func{void}{SetBellOnError}{\param{bool}{ doIt = TRUE}}
70
71 This functions switches on or turns off the error sound produced by the
72 validators if an invalid key is pressed.
73
74 \membersection{wxValidator::SetWindow}\label{wxvalidatorsetwindow}
75
76 \func{void}{SetWindow}{\param{wxWindow*}{ window}}
77
78 Associates a window with the validator.
79
80 \membersection{wxValidator::TransferFromWindow}\label{wxvalidatortransferfromwindow}
81
82 \func{virtual bool}{TransferToWindow}{\param{wxWindow*}{ parent}}
83
84 This overridable function is called when the value in the window must be
85 transferred to the validator. Return FALSE if there is a problem.
86
87 \membersection{wxValidator::TransferToWindow}\label{wxvalidatortransfertowindow}
88
89 \func{virtual bool}{TransferToWindow}{\param{wxWindow*}{ parent}}
90
91 This overridable function is called when the value associated with the validator must be
92 transferred to the window. Return FALSE if there is a problem.
93
94 \membersection{wxValidator::Validate}\label{wxvalidatorvalidate}
95
96 \func{virtual bool}{Validate}{\param{wxWindow*}{ parent}}
97
98 This overridable function is called when the value in the associated window must be validated.
99 Return FALSE if the value in the window is not valid; you may pop up an error dialog.
100
101