I’m trying to have a validate a certain wxTextCtrl on a wxPanel but it
doesn’t seem to be getting called when I enter data into the field or
on the EVT_BUTTON event.
All the examples I’ve seen using Validators have had the parent frame
be a wxDialog. Is there something specific about using a
Validator on a wxPanel that I am missing?
I'm trying to have a validate a certain wxTextCtrl on a wxPanel but it doesn't seem to be getting called when I enter data into the field or on the EVT_BUTTON event.
All the examples I've seen using Validators have had the parent frame be a wxDialog. Is there something specific about using a Validator on a wxPanel that I am missing?
you need to call LoginPanel.InitDialog() before showing it see doc:
When a wxDialog::Show is called (for a modeless dialog) or wxDialog::ShowModal is called (for a modal dialog), the function wxWindow::InitDialog is automatically called. This in turn sends an initialisation event to the dialog. The default handler for the wxEVT_INIT_DIALOG event is defined in the wxWindow class to simply call the function wxWindow::TransferDataToWindow. This function finds all the validators in the window's children and calls the TransferToWindow function for each. Thus, data is transferred from C++ variables to the dialog just as the dialog is being shown.
If you are using a window or panel instead of a dialog, you will need to call wxWindow::InitDialog explicitly before showing the window.
I'm trying to have a validate a certain wxTextCtrl on a wxPanel but it doesn't seem to be getting called when I enter data into the field or on the EVT_BUTTON event.
All the examples I've seen using Validators have had the parent frame be a wxDialog. Is there something specific about using a Validator on a wxPanel that I am missing?
you need to call LoginPanel.InitDialog() before showing it see doc:
But for doing actual validation instead of data transfer then you'll want to call the Validate method of the panel.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!