Page 1 of 1

accepting "Enter" from a wxTextCtrl

Posted: Fri Nov 09, 2007 9:20 pm
by forrestcupp
I have created a small program that accepts a name from a one line wxTextCtrl. I have a button next to it with a function to accept the input from the wxTextCtrl when clicked. When I enter text in the box and press Enter, it just moves the focus to the button.

How can I set it up so that pressing Enter will go to the function to accept the input instead of just moving the focus?

Posted: Fri Nov 09, 2007 10:28 pm
by timg
Be sure you create your wxTextCtrl with the wxTE_PROCESS_ENTER style, then add this:

Code: Select all

	EVT_TEXT_ENTER(ID_TEXTCTRL, myFrame::OnEnter)
To your EVENT_TABLE, of course changing the ID to your textctrl's ID and the function to whatever function you need.

Posted: Sat Nov 10, 2007 3:07 am
by forrestcupp
Thank you. The wxTE_PROCESS_ENTER was what I was missing.

I'm brand new at this, so please bear with my simple questions.