MDI Child Custom Control: Incorrect Window Focus After MSGBOX

ID Number: Q80826

1.00

WINDOWS

buglist1.00

Summary:

When two or more MDI child windows are placed on a form and a message

box is brought up either by choosing a menu item or by clicking with

the mouse on the parent form, the focus will sometimes return to the

wrong MDI child window. If the MDIChild1 window has the focus, and you

click on the form to bring up a message box or another modal form, the

focus may return to the MDIChild2 window after canceling the message

box.

This behavior cannot be consistently reproduced.

This problem occurs with the MDI Child custom control supplied with

Microsoft Professional Toolkit for Microsoft Visual Basic programming

system version 1.0 for Windows. We are researching this problem and

will post new information here as it becomes available.

More Information:

The following pseudocode example will possibly demonstrate the problem

of an MDI child window losing the focus after a message box has been

brought up.

1. In the Visual Basic 1.0 programming environment, choose Add File

from the File menu, and select the MDICHILD.VBX custom control.

2. Select the MDI Child control from the Toolbox.

3. Click and drag on the form to place an MDI child window control.

Repeat this step to place another MDI child window on Form1.

4. Double-click on the form outside the MDI child windows to bring up

a Code window.

5. Add the following code to the Form_Click event procedure:

Sub Form_Click ()

MSGBOX "Foo"

End Sub

6. From the Run menu, choose Start to run the application.

7. Click on the MDIChild1 window to give it the focus.

8. Click on the form directly to bring up the message box.

9. Choose the OK button to dismiss the message box.

Note that MDIChild2 has the focus. The focus should have returned to the

MDIChild1 window but does not do so consistently. The same problem can

occur when a modal dialog box or form is brought up from a menu item.

Additional reference words: 1.00 MDIChild