Active MDI Child help

joe_pool_is

Contributor
Joined
Jan 18, 2004
Messages
507
Location
Longview, TX [USA]
In my MDI Child forms, how can *they* tell if they are the focused form?

A few of my forms have timers that ensure it's single text entry field always has the focus, and sets the focus there if it does not. For simplicity, I'll call these AutoFocus forms as opposed to Standard forms.

AutoFocus forms work great when no other form Mdi Child form is visible, but I am having problems in the other cases.

In each of the AutoFocus forms, I have attempted to determine if that form is the active form, but I get nothing.

Code:
// Code in AutoFocus forms:
void Timer_Tick(object sender, EventArgs e)
{
  // Here is one way I tried, but even
  // if the form itself is not visible, its
  // Visible property is still True:
  if (Visible == true)
  {
    // other code
  }
  // Here is another way I tried, but if
  // the Form's focus is on one of it's
  // containing Controls, it returns False:
  if (Focused == true)
  {
    // other code
  }
}

Does anyone even know what value I'm looking for? There has to be a way for the child form to determine if the parent is giving it top focus, but I certainly don't know what it is.

Does anyone know how to tell this?
 
Back
Top