Closing MDI Child May Not Move Focus to Other VB Control

ID Number: Q83805

1.00

WINDOWS

buglist1.00

Summary:

When the Visible property of an MDI Child control is set to False(0),

input focus will not be transferred to another MDI Child control

correctly unless another "standard" Visual Basic control is on the

other MDI Child control that can receive input focus. Although some

custom controls can receive input focus, they may not update the MDI

Child caption bar to show that they have received input focus. Another

MDI Child control with either no controls, or a picture control only,

or a frame only, or a label only, will not receive focus.

Microsoft has confirmed this to be a problem in 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:

Steps to Reproduce Problem

--------------------------

The sample code below demonstrates the problem of the MDI Child not

moving the input focus to a visible control when its Visible property

is set to False(0).

1. Run Visual Basic, or from the File menu, choose New Project (ALT,

F, N) if Visual Basic is already running. Form1 is created by

default.

2. From the File menu, choose Add File. In the Files box, select the

MDICHILD.VBX custom control file. The MDI Child tool appears in the

Toolbox.

3. Add the following controls to Form1, and set the following

properties:

Control Control Name Index

------- ------------ -----

Form Form1

MDIChild MDIChild1 0 'Create a control array

MDIChild MDIChild1 1 'of three MDIChild

MDIChild MDIChild1 2 'controls.

4. On each of the MDIChild1 controls, add a 3-D Option Button.

5. In the MDIChild1_Close event, add the following code to hide the

MDI Child control:

Sub MDIChild1_Close (Index As Integer)

MDIChild1(Index).Visible = 0

End Sub

6. Press F5 to run the program. Set focus to one of the MDI Child

controls that do not have focus. From the MDI Child Control menu,

choose Close to hide the control. Notice that the focus does not

move to one of the other MDI Child controls, yet the 3-D Option

Button has the focus.

If you replace the 3-D Option Buttons with the "standard" option

button supplied with Visual Basic and perform the above steps, focus

will correctly move to one of the other visible controls when you

close the MDI Child control.

Additional reference words: 1.00 MDIChild Option3D