简体   繁体   中英

why are Key events c++ WxWidgets not being caught?

Good day guys

I am using WxWidgets 2.8. I have created a grid like interface using text boxes. I would like to change the values in text boxes by simply navigating to them using the arrow keys.

I have set up a panel in which the text boxes are placed, then added a onkeydown event which should just display a message when a key is pressed. This does not work.

I have tried oncharevent, and even adding the the events to the wxFrame.

Why can I not catch the key events?

Only the currently focused window gets the key events and the frame will never have focus if it has any children taking it, such as text controls.

Also do consider using wxWidgets 3.0 for any new code, in particular it provides Bind() which can be convenient for handling key events from all your controls in a single place if this is what you want to do.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM