You can optionally define event handlers for the validator, to implement filtering. These handlers
will capture events before the control itself does.
-For an example implementation, see the valtext.h and valtext.cpp files in the wxWindows library.
+For an example implementation, see the valtext.h and valtext.cpp files in the wxWidgets library.
\wxheading{How validators interact with dialogs}
\begin{verbatim}
void wxDialog::OnOK(wxCommandEvent& event)
{
- if ( Validate() && TransferDataFromWindow() )
- {
+ if ( Validate() && TransferDataFromWindow() )
+ {
if ( IsModal() )
EndModal(wxID_OK);
else
{
- SetReturnCode(wxID_OK);
- this->Show(false);
+ SetReturnCode(wxID_OK);
+ this->Show(false);
}
- }
+ }
}
\end{verbatim}