Get MdiChild focus back from parent control!

  • Thread starter Thread starter Jianren Lu
  • Start date Start date
J

Jianren Lu

Dear all,
I am currently design a mdi program using C# and .net framework. I
met a problem that when I clicked the controls in parent form, such as
buttons, numericUpDown, etc, the control get focus, and I can't get
activeMdiChild focus back even I set ActiveMdiChild.Focus().
I seems like there are many such kind of discussions about this,
but till now I can not find the right solution. Please help!
Sincerely
Jianren
 
I have come across a symptons that may be similar to those you describe.

In my case it involved a the AfterSelect event in a Treeview and MDIChild
form.
In that event, if I set the focus to the MDIChild form, the Treeview got the
focus back before the event handler code was exited.

My suspicion is that the AfterSelect event fired before the Click was fully
completed but don't quote me on that.

How I worked around it was to have a timer with a short interval (100ms) and
start that in the event handler and then set the focus to the MDIChild form
when the timer fired.

This may not solve your particular issues but it might point you in the
right direction.
 
Back
Top