I'm trying to make some app using wxwidgets. I created a bit of GUI using wxformbuilder and now I want one of my textctrl to use numeric validator. I set it up in wxformbuilder like this:
So I made validator_type
wxTextValidator
, checked validator_style
: wxFILTER_NUMERIC
and unchecked wxFILTER_NONE
. And set validator_data_type
to wxString
.
But it seems that there's no code related to validators in generated files. Here's all code that works with that textctrl:
m_textCtrl5 = new wxTextCtrl( m_panel9, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_RIGHT );
fgSizer9->Add( m_textCtrl5, 0, wxALL|wxEXPAND, 5 );
I tried to make it earlier and I had the same problem. I generated inherited class and made it work by simply writing that validator code myself but I don't want to do the same thing now.
Am I doing something wrong or is this thing just not working?
To add a numeric validator, you also need to assign a string variable to hold the contents being validated. In wxFormbuilder you just need to fill in the "validator_variable" area like so: