]>
Commit | Line | Data |
---|---|---|
a660d684 KB |
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 | ||
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 | ||
43 | Constructor. | |
44 | ||
45 | \membersection{wxValidator::\destruct{wxValidator}} | |
46 | ||
47 | \func{}{\destruct{wxValidator}}{\void} | |
48 | ||
49 | Destructor. | |
50 | ||
51 | \membersection{wxValidator::Clone}\label{wxvalidatorclone} | |
52 | ||
53 | \constfunc{virtual wxValidator*}{Clone}{\void} | |
54 | ||
55 | All validator classes must implement the {\bf Clone} function, which returns | |
56 | an identical copy of itself. This is because validators are passed to control | |
57 | constructors as references which must be copied. Unlike objects such as pens | |
58 | and brushes, it does not make sense to have a reference counting scheme | |
59 | to do this cloning, because all validators should have separate | |
60 | data. | |
61 | ||
62 | This base function returns NULL. | |
63 | ||
64 | \membersection{wxValidator::GetWindow}\label{wxvalidatorgetwindow} | |
65 | ||
66 | \constfunc{wxWindow*}{GetWindow}{\void} | |
67 | ||
68 | Returns the window associated with the validator. | |
69 | ||
a994f81b VZ |
70 | \membersection{wxValidator::SetBellOnError}{wxvalidatorsetbellonerror} |
71 | ||
72 | \func{void}{SetBellOnError}{\param{bool}{ doIt = TRUE}} | |
73 | ||
74 | This functions switches on or turns off the error sound produced by the | |
75 | validators if an invalid key is pressed. | |
76 | ||
a660d684 KB |
77 | \membersection{wxValidator::SetWindow}\label{wxvalidatorsetwindow} |
78 | ||
79 | \func{void}{SetWindow}{\param{wxWindow*}{ window}} | |
80 | ||
81 | Associates a window with the validator. | |
82 | ||
83 | \membersection{wxValidator::TransferFromWindow}\label{wxvalidatortransferfromwindow} | |
84 | ||
85 | \func{virtual bool}{TransferToWindow}{\param{wxWindow*}{ parent}} | |
86 | ||
87 | This overridable function is called when the value in the window must be | |
88 | transferred 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 | ||
94 | This overridable function is called when the value associated with the validator must be | |
95 | transferred 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 | ||
101 | This overridable function is called when the value in the associated window must be validated. | |
102 | Return FALSE if the value in the window is not valid; you may pop up an error dialog. | |
103 | ||
104 |