wxEVT_CHAR

Hi,

I have a function that (via wxEVT_CHAR) is called when a character is
entered into a wxTextControl. This function checks if "event.KeyCode()
== WXK_RETURN" and does stuff if it is. This works fine under Linux,
but when run under windows, it is not getting called when the enter key
is pressed when the focus is on the appropriate TextCtrl. It does get
challed when other characters are entered into the TextCtrl.

Is there a way of getting the functionality I'm seeing when running on
Linux to happen when running on Windows. Alternatively, is there some
other way of getting enter key presses to result in a function call when
a TextCtrl has the focus?

With thanks,

Jon.

···

--
Jonathan Stoneman - Programmer - Frontier Internet Services Limited
Tel: 02920 820000 Fax: 02920 820038 http://www.frontier.net.uk
All statements made are subject to Frontier's Terms and Conditions
of Business which are available upon request.

Jonathan Stoneman wrote:

I have a function that (via wxEVT_CHAR) is called when a character is
entered into a wxTextControl. This function checks if "event.KeyCode()
== WXK_RETURN" and does stuff if it is. This works fine under Linux,
but when run under windows, it is not getting called when the enter key
is pressed when the focus is on the appropriate TextCtrl.

Is this perhaps inside of a dialog/panel? Dialogs and panels use enter and tab keys for their own navigation, so those character events are eaten before they get to your text control. Try creating the control with the wxWANTS_CHARS style, to tell the parent to pass along those keys to the text control first.

Jeff Shannon
Technician/Programmer
Credit International

You need to add the style wxTE_PROCESS_ENTER on your wxTextCtrl.

···

On Thu, 2003-09-04 at 10:50, Jonathan Stoneman wrote:

Hi,

I have a function that (via wxEVT_CHAR) is called when a character is
entered into a wxTextControl. This function checks if "event.KeyCode()
== WXK_RETURN" and does stuff if it is. This works fine under Linux,
but when run under windows, it is not getting called when the enter key
is pressed when the focus is on the appropriate TextCtrl. It does get
challed when other characters are entered into the TextCtrl.

Is there a way of getting the functionality I'm seeing when running on
Linux to happen when running on Windows. Alternatively, is there some
other way of getting enter key presses to result in a function call when
a TextCtrl has the focus?

With thanks,

Jon.

--
Jim West
CheckLogix -a Concord company
102 S. Tejon Ste 920, Colorado Springs, CO 80903
719.633.7005 x223 Fax: 719.633.7006 Cell: 719.660.5676

That got it to work the way I wanted, thanks.

Jon.

···

On Thu, 2003-09-04 at 18:57, Jim West wrote:

You need to add the style wxTE_PROCESS_ENTER on your wxTextCtrl.

--
Jonathan Stoneman - Programmer - Frontier Internet Services Limited
Tel: 02920 820000 Fax: 02920 820038 http://www.frontier.net.uk
All statements made are subject to Frontier's Terms and Conditions
of Business which are available upon request.