How to use wxTextCtrl->EmulateKeyPress?

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
User avatar
Parduz
Experienced Solver
Experienced Solver
Posts: 53
Joined: Fri Jan 30, 2015 1:48 pm
Location: Bologna, Italy

How to use wxTextCtrl->EmulateKeyPress?

Post by Parduz » Thu Jan 31, 2019 3:27 pm

I've searched for it and read some forum answers (this in particular), but i had no success.

I have an hardware keyboard connected to my Beaglebone, which i read using i2c, then i convert the i2c_keycode in a wxKeyCode (WXK_something, you can think at the keys of a numpad, to have an idea, so WXK_RETURN, WXK_NUMPAD1, etc).

Now i need to "send" the wxKeyCode to the wxTextCtrl with the active focus (i store a pointer to it), but

Code: Select all

wxKeyEvent& keyEvent(EVT_CHAR);
keyEvent.m_keyCode = myWxKeyCode;
myTextCtrl->EmulateKeyPress(keyEvent);
does'nt compile, 'cause EVT_CHAR is not declared.
(Also, i'd like more to generate a KEYDOWN event than a char).

What should i do?

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 3351
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: How to use wxTextCtrl->EmulateKeyPress?

Post by ONEEYEMAN » Thu Jan 31, 2019 3:58 pm

Hi,
What's an exact error message?
Did you include all necessary headers?

Thank you.

Manolo
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 689
Joined: Mon Apr 30, 2012 11:07 pm

Re: How to use wxTextCtrl->EmulateKeyPress?

Post by Manolo » Thu Jan 31, 2019 5:14 pm

Code: Select all

wxKeyEvent keyEvent(wxEVT_CHAR);

Post Reply