Home > Software engineering >  How to get if User pressed Enter wxWidgets
How to get if User pressed Enter wxWidgets

Time:05-30

I want to get the Input from a field

wxTextCtrl* upperOnly = new wxTextCtrl(this, wxID_ANY, wxT("Test"),wxPoint(5,260), wxSize(630,30));

and this i want every Time the user Pressed Enter

CodePudding user response:

Use wxTE_PROCESS_ENTER when creating the control, i.e.

wxTextCtrl* upperOnly = new wxTextCtrl(this, wxID_ANY, wxT("Test"),wxPoint(5,260), wxSize(630,30), wxTE_PROCESS_ENTER);

Then catch wxEVT_TEXT_ENTER and do your validation in its event handler, i.e.

upperOnly->Bind(wxEVT_TEXT_ENTER, [](wxCommandEvent&) {
        // Do something useful
     });
  • Related