After pressing enter from a wxTextCtrl I bind an event to SetFocus back onto it.
However, when the SetFocus event runs, all the text in the wxTextCtrl is selected. You can't do anything until you use the mouse and click on the wxControl.
Any ideas on how to make the focus to after the text so the person can just keep typing?
Code: Select all
searchInput = new wxTextCtrl(Panel, wxID_ANY, wxEmptyString, wxDefaultPosition,wxDefaultSize,wxTE_PROCESS_ENTER);
searchInput->SetValue("");
searchButton = new wxButton(Panel, wxID_ANY, "Search");
searchButton->Bind(wxEVT_BUTTON, &MyFrame::OnSearch, this);
searchInput->Bind(wxEVT_TEXT_ENTER, [&](wxCommandEvent&) {
wxCommandEvent evt(wxEVT_BUTTON, searchButton->GetId());
evt.SetEventObject(this);
wxPostEvent(searchButton, evt);
searchInput->SetFocus();
});