wxEVT_CHAR_HOOK events not triggered

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
charvey1
Knows some wx things
Knows some wx things
Posts: 30
Joined: Sun Jan 09, 2022 6:39 am

wxEVT_CHAR_HOOK events not triggered

Post by charvey1 »

I have a wxTextCtrl and a wxSlider which both cause a calculation to run in a secondary thread. The wxTextCtrl starts the secondary thread OnEnter, and the wxSlider starts it on releasing the thumbtack.

While the secondary thread is running, a custom busyinfo frame is displayed with all other windows disabled (using wxWindowDisabler). The busyinfo frame listens for wxEVT_CHAR_HOOK events (periodically yielding to see if anything has happened with the keyboard until the secondary thread joins).

If the text control makes the input, then wxEVT_CHAR_HOOK events are triggered, exactly as I want.

However, if the slider makes the input, wxEVT_CHAR_HOOK are only triggered if I use the mouse to click on the busyinfo frame first. I want the busyinfo frame to have keyboard focus without clicking on it.

The busyinfo frame has the focus the whole time (I've confirmed that), so it's not to do with focus.

I called Skip() on all slider events. So I don't think it's that.

I think what may be happening is that the slider control captures the mouse, and holds on to the mouse capture while the window is disabled, and this prevents keyboard events from being triggered. Could it be this? If so, how could I solve it? I've tried out MouseCapture and MouseRelease on the busyinfo frame, but no luck there.

Many thanks. :-)
OS: Windows 10 Enterprise
Compiler: G++ 13.2.0
WX version: 3.2.2.1
charvey1
Knows some wx things
Knows some wx things
Posts: 30
Joined: Sun Jan 09, 2022 6:39 am

Re: wxEVT_CHAR_HOOK events not triggered

Post by charvey1 »

It looks like I may have solved this myself, with one application of "ReleaseMouse()" before running the secondary thread.

Definitely more luck than judgement.
OS: Windows 10 Enterprise
Compiler: G++ 13.2.0
WX version: 3.2.2.1
Post Reply