-\section{Validator overview}\label{validatoroverview}
+\section{wxValidator overview}\label{validatoroverview}
Classes: \helpref{wxValidator}{wxvalidator}, \helpref{wxTextValidator}{wxtextvalidator},
\helpref{wxGenericValidator}{wxgenericvalidator}
Here is an example of wxTextValidator usage.
\begin{verbatim}
- wxTextCtrl *txt1 = new wxTextCtrl(this, VALIDATE_TEXT, "",
+ wxTextCtrl *txt1 = new wxTextCtrl(this, -1, wxT(""),
wxPoint(10, 10), wxSize(100, 80), 0,
wxTextValidator(wxFILTER_ALPHA, &g_data.m_string));
\end{verbatim}
the validator should store the data internally.
The \helpref{wxValidator::Validate}{wxvalidatorvalidate} member function should return
-TRUE if the data in the control (not the C++ variable) is valid. It should also show
+true if the data in the control (not the C++ variable) is valid. It should also show
an appropriate message if data was not valid.
The \helpref{wxValidator::TransferToWindow}{wxvalidatortransfertowindow} member function should
window.}
When the user clicks on a button, for example the OK button, the application should
-first call \helpref{wxWindow::Validate}{wxwindowvalidate}, which returns FALSE if
+first call \helpref{wxWindow::Validate}{wxwindowvalidate}, which returns false if
any of the child window validators failed to validate the window data. The button handler
should return immediately if validation failed. Secondly, the application should
call \helpref{wxWindow::TransferDataFromWindow}{wxwindowtransferdatafromwindow} and
else
{
SetReturnCode(wxID_OK);
- this->Show(FALSE);
+ this->Show(false);
}
}
}
So if using validators and a normal OK button, you may not even need to write any
code for handling dialog dismissal.
-If you load your dialog from a resource file, you'll need to iterate through the controls
+If you load your dialog from a resource file, you will need to iterate through the controls
setting validators, since validators can't be specified in a dialog resource.