Boying
Boying

Reputation: 1434

How to make customized widgets take keyboard events like textctrls

Platform Windows

Created a control using windows API: CreateWindowExW and set it's parent to a panel hwnd

But it seems the control does not handle arrow keys, enter keys and tab keys properly.

Is there any flag on wxwidgets give any control created by CreateWindowExW the same ability like edit controls to capture arrow keys, enter keys and tab keys?

Upvotes: 1

Views: 41

Answers (1)

VZ.
VZ.

Reputation: 22678

The problem might be due to not using WS_EX_CONTROLPARENT for your control when creating it, this style is needed for the built-in tab navigation to work.

And while I don't think it's going to help with your particular problem, I'd still like to say that embedding a native control in an application using wxWidgets is not quite as simple as just giving it the HWND of an existing control as parent, you may want to look at wxNativeWindow (new in wxWidgets 3.1.0) for how to do it correctly.

Upvotes: 1

Related Questions