Benn1x
Benn1x

Reputation: 45

How to get if User pressed Enter wxWidgets

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

Upvotes: 0

Views: 441

Answers (1)

catalin
catalin

Reputation: 1987

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
     });

Upvotes: 2

Related Questions