Previous focused control

  • Thread starter Thread starter Mikhail Fedosov
  • Start date Start date
M

Mikhail Fedosov

Hello all!

Please tell me how to determine thr previous focused control when the other
control get focus.
Enter and GotFocus events does not provide this information.
 
Hi Mikhail,

AFAIK there is no managed way, unless you don't take care of this yourself.
 
* "Stoitcho Goutsev \(100\) said:
AFAIK there is no managed way, unless you don't take care of this yourself.

Listening in the form's 'WndProc' for 'WM_SETFOCUS' should work.
'wParam' contains the window handle to the control that lost focus.
 
yourself.

Listening in the form's 'WndProc' for 'WM_SETFOCUS' should work.
'wParam' contains the window handle to the control that lost focus.

Yes, it should work if you write classes for all the controls (the inherit
from the respective winforms controls in order to override WndProg) on the
form and in this way gave up the benefits of using the form designer.
WM_SETFOCUS is sent message as such it doesn't go thru the message queue.
That's why MessageFilters global for the UI thread won't do as well.
It could be handled that's why I said "... unless you don't take care of
this yourself" :)
 
The WM_SETFOCUS does not processed by Form's WndProc. This message comes to
the certain control that received focus.
So it is very boring to inherit my new control from each control which I
have to monitor.

My task is to perform some actions when user go away from group of two
controls. He can jump between these controls, but when he jump away I should
do some work.
 
Back
Top