-
I have a program with an MDI form and several children, and to keep track of them as a new child is loaded, I assign each a unique tag, and use a variable to hold the tag of the currently used child. The problem is that I have the command that sets the variable to a specific window inside the main child form's GetFocus event:
Code:
Private Sub Form_GetFocus()
CurrentWindowTag = Me.Tag
End Sub
I would think this works, but for some reason the GetFocus event for the child forms doesn't seem to fire. I set up a thing to print CurrentWindowTag, but when I switch between different child windows, the tag never seems to change, even though each window has a unique tag. Is there something weird about MDI child forms and how they get/lose the focus? Does a form get the focus when any control on it gets the focus?
-
Try the Activate event instead. :rolleyes:
-
well there's also a property called activeform in the MDIform that returns the child form that has the focus, so you could access it's Tag by:
Code:
MDIForm1.ActiveForm.Tag