General issue: When application doesn't have focus, and you click a button on it, it doesn't register....
-
You have to click the button twice to get the desired button effect - once to give the application focus, and then once to actually fire the buttonclick event, I assume. Is there a general approach that's applicable to all (or the vast majority) of controls, so that one click on a button/control suffices to trigger the click event, whether or not the app has focus at the time of the click?
-
You have to click the button twice to get the desired button effect - once to give the application focus, and then once to actually fire the buttonclick event, I assume. Is there a general approach that's applicable to all (or the vast majority) of controls, so that one click on a button/control suffices to trigger the click event, whether or not the app has focus at the time of the click?
sherifffruitfly wrote:
You have to click the button twice to get the desired button effect - once to give the application focus, and then once to actually fire the buttonclick event, I assume.
I've noticed this in .NET apps (and MS Office apps running on WinXP and above). My MFC 4.2 (VC6) apps (running on all OSs) work as you would expect - clicking a toolbar button activates the window and causes the button's handler code to execute. You might want to try handling the
WM_MOUSEACTIVATE
event in your application's top level Form and posting aWM_LBUTTONDOWN
to theControl
under the mouse (if any). Good luck! /raviMy new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com