On Fri, 26 Feb 2021 16:02:39 +0100 QuentinC wrote:
Q> However, it doesn't work as I wish if the dialog box is opened while I'm
Q> doing something else in another application.
FWIW I'd try to avoid opening a dialog box non-interactively in the first
place. People usually don't like when dialogs pop up on their own.
Q> wxEVT_ACTIVATE on the dialog box and wxEVT_SET_FOCUS are both triggered
Q> even if I'm on another application, and this isn't the right moment. IN
Q> that case, I would like something to be triggered only when I come back
Q> to my application with Alt+Tab or click somewhere inside the dialog box.
You might be able to use wxEVT_ACTIVATE_APP to detect this.
Q> So far, I have observed that:
Q> 1. wxEVT_ACTIVATE is triggered immediately when the dialog box is shown,
Q> even if the focus is another application. e.GetActive() returns true,
Q> which is incorrect from my point of view. I can't count on this event.
I admit I'm surprised by this too but, without debugging it, I'd guess
it's MSW itself which sends WM_ACTIVATE and so there is probably not much
we can do about it.
Q> 3. More strange: wxEVT_ACTIVATE is **NOT** triggered the first time I
Q> come back to the dialog box with Alt+Tab.
I think this is a consequence of (1) above, if it's already active, it's
not going to become active again.
Q> I tried a few alternatives to achieve what I want, with no more luck:
Q> 1. IsShown() and IsShownOnScreen() both return true, both for the
Q> webview and the dialog box itself, even if I'm in another application. I
Q> don't well understand why but bad luck.
These functions just check that the window is not hidden. They don't check
if it's not obstructed by other windows.
Regards,
VZ
--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/