]>
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 | ||
76e1c2de | 21 | \pythonnote{If you wish to create a validator class in wxPython you should |
c9110876 | 22 | derive the class from {\tt wxPyValidator} in order to get Python-aware |
76e1c2de RD |
23 | capabilities 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 | ||
b2cf617c JS |
36 | \helpref{Validator overview}{validatoroverview}, |
37 | \helpref{wxTextValidator}{wxtextvalidator}, | |
76e1c2de | 38 | \helpref{wxGenericValidator}{wxgenericvalidator}, |
8bb8ab39 | 39 | |
a660d684 KB |
40 | \latexignore{\rtfignore{\wxheading{Members}}} |
41 | ||
15d83f72 | 42 | \membersection{wxValidator::wxValidator}\label{wxvalidatorctor} |
a660d684 KB |
43 | |
44 | \func{}{wxValidator}{\void} | |
45 | ||
46 | Constructor. | |
47 | ||
15d83f72 | 48 | \membersection{wxValidator::\destruct{wxValidator}}\label{wxvalidatordtor} |
a660d684 KB |
49 | |
50 | \func{}{\destruct{wxValidator}}{\void} | |
51 | ||
52 | Destructor. | |
53 | ||
54 | \membersection{wxValidator::Clone}\label{wxvalidatorclone} | |
55 | ||
47210d02 | 56 | \constfunc{virtual wxObject*}{Clone}{\void} |
a660d684 KB |
57 | |
58 | All validator classes must implement the {\bf Clone} function, which returns | |
59 | an identical copy of itself. This is because validators are passed to control | |
60 | constructors as references which must be copied. Unlike objects such as pens | |
61 | and brushes, it does not make sense to have a reference counting scheme | |
62 | to do this cloning, because all validators should have separate | |
63 | data. | |
64 | ||
65 | This base function returns NULL. | |
66 | ||
67 | \membersection{wxValidator::GetWindow}\label{wxvalidatorgetwindow} | |
68 | ||
69 | \constfunc{wxWindow*}{GetWindow}{\void} | |
70 | ||
71 | Returns the window associated with the validator. | |
72 | ||
15d83f72 | 73 | \membersection{wxValidator::SetBellOnError}\label{wxvalidatorsetbellonerror} |
a994f81b | 74 | |
cc81d32f | 75 | \func{void}{SetBellOnError}{\param{bool}{ doIt = true}} |
a994f81b VZ |
76 | |
77 | This functions switches on or turns off the error sound produced by the | |
78 | validators if an invalid key is pressed. | |
79 | ||
a660d684 KB |
80 | \membersection{wxValidator::SetWindow}\label{wxvalidatorsetwindow} |
81 | ||
82 | \func{void}{SetWindow}{\param{wxWindow*}{ window}} | |
83 | ||
84 | Associates a window with the validator. | |
85 | ||
86 | \membersection{wxValidator::TransferFromWindow}\label{wxvalidatortransferfromwindow} | |
87 | ||
76e1c2de | 88 | \func{virtual bool}{TransferToWindow}{} |
a660d684 KB |
89 | |
90 | This overridable function is called when the value in the window must be | |
cc81d32f | 91 | transferred to the validator. Return false if there is a problem. |
a660d684 KB |
92 | |
93 | \membersection{wxValidator::TransferToWindow}\label{wxvalidatortransfertowindow} | |
94 | ||
76e1c2de | 95 | \func{virtual bool}{TransferToWindow}{} |
a660d684 KB |
96 | |
97 | This overridable function is called when the value associated with the validator must be | |
cc81d32f | 98 | transferred to the window. Return false if there is a problem. |
a660d684 KB |
99 | |
100 | \membersection{wxValidator::Validate}\label{wxvalidatorvalidate} | |
101 | ||
102 | \func{virtual bool}{Validate}{\param{wxWindow*}{ parent}} | |
103 | ||
104 | This overridable function is called when the value in the associated window must be validated. | |
cc81d32f | 105 | Return false if the value in the window is not valid; you may pop up an error dialog. |
a660d684 | 106 |