]>
Commit | Line | Data |
---|---|---|
a660d684 KB |
1 | \section{\class{wxTextValidator}}\label{wxtextvalidator} |
2 | ||
3 | wxTextValidator validates text controls, providing a variety of filtering behaviours. | |
4 | ||
5 | For more information, please see \helpref{Validator overview}{validatoroverview}. | |
6 | ||
7 | \wxheading{Derived from} | |
8 | ||
9 | \helpref{wxValidator}{wxvalidator}\\ | |
10 | \helpref{wxEvtHandler}{wxevthandler}\\ | |
11 | \helpref{wxObject}{wxobject} | |
12 | ||
954b8ae6 JS |
13 | \wxheading{Include files} |
14 | ||
15 | <wx/valtext.h> | |
16 | ||
a660d684 KB |
17 | \wxheading{See also} |
18 | ||
76e1c2de | 19 | \helpref{Validator overview}{validatoroverview}, \helpref{wxValidator}{wxvalidator}, |
89c684ef | 20 | \helpref{wxGenericValidator}{wxgenericvalidator} |
a660d684 KB |
21 | |
22 | \latexignore{\rtfignore{\wxheading{Members}}} | |
23 | ||
15d83f72 | 24 | \membersection{wxTextValidator::wxTextValidator}\label{wxtextvalidatorctor} |
a660d684 KB |
25 | |
26 | \func{}{wxTextValidator}{\param{const wxTextValidator\&}{ validator}} | |
27 | ||
28 | Copy constructor. | |
29 | ||
eaaa6a06 | 30 | \func{}{wxTextValidator}{\param{long}{ style = wxFILTER\_NONE}, \param{wxString* }{valPtr = NULL}} |
a660d684 KB |
31 | |
32 | Constructor, taking a style and optional pointer to a wxString variable. | |
33 | ||
34 | \wxheading{Parameters} | |
35 | ||
36 | \docparam{style}{A bitlist of flags, which can be: | |
37 | ||
38 | \twocolwidtha{5cm} | |
39 | \begin{twocollist} | |
40 | \twocolitem{{\bf wxFILTER\_NONE}}{No filtering takes place.} | |
41 | \twocolitem{{\bf wxFILTER\_ASCII}}{Non-ASCII characters are filtered out.} | |
42 | \twocolitem{{\bf wxFILTER\_ALPHA}}{Non-alpha characters are filtered out.} | |
43 | \twocolitem{{\bf wxFILTER\_ALPHANUMERIC}}{Non-alphanumeric characters are filtered out.} | |
44 | \twocolitem{{\bf wxFILTER\_NUMERIC}}{Non-numeric characters are filtered out.} | |
45 | \twocolitem{{\bf wxFILTER\_INCLUDE\_LIST}}{Use an include list. The validator | |
8161ba08 | 46 | checks if the user input is on the list, complaining if not. See |
f94a790d | 47 | \helpref{wxTextValidator::SetIncludes}{wxtextvalidatorsetincludes}.} |
a660d684 | 48 | \twocolitem{{\bf wxFILTER\_EXCLUDE\_LIST}}{Use an exclude list. The validator |
8161ba08 | 49 | checks if the user input is on the list, complaining if it is. See |
f94a790d | 50 | \helpref{wxTextValidator::SetExcludes}{wxtextvalidatorsetexcludes}.} |
aaae8296 | 51 | \twocolitem{{\bf wxFILTER\_INCLUDE\_CHAR\_LIST}}{Use an include list. The validator |
8161ba08 | 52 | checks if each input character is in the list (one character per list element), complaining if not. |
f94a790d | 53 | See \helpref{wxTextValidator::SetIncludes}{wxtextvalidatorsetincludes}.} |
387ebd3e | 54 | \twocolitem{{\bf wxFILTER\_EXCLUDE\_CHAR\_LIST}}{Use an include list. The validator |
8161ba08 | 55 | checks if each input character is in the list (one character per list element), complaining if it is. |
f94a790d | 56 | See \helpref{wxTextValidator::SetExcludes}{wxtextvalidatorsetexcludes}.} |
a660d684 KB |
57 | \end{twocollist} |
58 | } | |
59 | ||
60 | \docparam{valPtr}{A pointer to a wxString variable that contains the value. This variable | |
61 | should have a lifetime equal to or longer than the validator lifetime (which is usually | |
cc81d32f | 62 | determined by the lifetime of the window). % If NULL, the validator uses its own internal storage for the value. NOT true |
2b5f62a0 | 63 | } |
a660d684 | 64 | |
a660d684 KB |
65 | \membersection{wxTextValidator::Clone}\label{wxtextvalidatorclone} |
66 | ||
89c684ef | 67 | \constfunc{virtual wxValidator*}{Clone}{\void} |
a660d684 KB |
68 | |
69 | Clones the text validator using the copy constructor. | |
70 | ||
f94a790d | 71 | \membersection{wxTextValidator::GetExcludes}\label{wxtextvalidatorgetexcludes} |
a660d684 | 72 | |
f94a790d | 73 | \constfunc{wxArrayString\&}{GetExcludes}{\void} |
a660d684 KB |
74 | |
75 | Returns a reference to the exclude list (the list of invalid values). | |
76 | ||
f94a790d | 77 | \membersection{wxTextValidator::GetIncludes}\label{wxtextvalidatorgetincludes} |
a660d684 | 78 | |
f94a790d | 79 | \constfunc{wxArrayString\&}{GetIncludes}{\void} |
a660d684 KB |
80 | |
81 | Returns a reference to the include list (the list of valid values). | |
82 | ||
83 | \membersection{wxTextValidator::GetStyle}\label{wxtextvalidatorgetstyle} | |
84 | ||
85 | \constfunc{long}{GetStyle}{\void} | |
86 | ||
87 | Returns the validator style. | |
88 | ||
89 | \membersection{wxTextValidator::OnChar}\label{wxtextvalidatoronchar} | |
90 | ||
91 | \func{void}{OnChar}{\param{wxKeyEvent\&}{ event}} | |
92 | ||
93 | Receives character input from the window and filters it according to the | |
94 | current validator style. | |
95 | ||
f94a790d | 96 | \membersection{wxTextValidator::SetExcludes}\label{wxtextvalidatorsetexcludes} |
a660d684 | 97 | |
f94a790d | 98 | \func{void}{SetExcludes}{\param{const wxArrayString\&}{ stringList}} |
a660d684 KB |
99 | |
100 | Sets the exclude list (invalid values for the user input). | |
101 | ||
f94a790d | 102 | \membersection{wxTextValidator::SetIncludes}\label{wxtextvalidatorsetincludes} |
a660d684 | 103 | |
f94a790d | 104 | \func{void}{SetIncludes}{\param{const wxArrayString\&}{ stringList}} |
a660d684 KB |
105 | |
106 | Sets the include list (valid values for the user input). | |
107 | ||
108 | \membersection{wxTextValidator::SetStyle}\label{wxtextvalidatorsetstyle} | |
109 | ||
110 | \func{void}{SetStyle}{\param{long}{ style}} | |
111 | ||
112 | Sets the validator style. | |
113 | ||
114 | \membersection{wxTextValidator::TransferFromWindow}\label{wxtextvalidatortransferfromwindow} | |
115 | ||
76e1c2de | 116 | \func{virtual bool}{TransferFromWindow}{} |
a660d684 | 117 | |
b853ebf6 | 118 | Transfers the value in the text control to the string. |
a660d684 KB |
119 | |
120 | \membersection{wxTextValidator::TransferToWindow}\label{wxtextvalidatortransfertowindow} | |
121 | ||
76e1c2de | 122 | \func{virtual bool}{TransferToWindow}{} |
a660d684 | 123 | |
b853ebf6 | 124 | Transfers the string value to the text control. |
a660d684 KB |
125 | |
126 | \membersection{wxTextValidator::Validate}\label{wxtextvalidatorvalidate} | |
127 | ||
128 | \func{virtual bool}{Validate}{\param{wxWindow*}{ parent}} | |
129 | ||
130 | Validates the window contents against the include or exclude lists, depending | |
131 | on the validator style. | |
132 |