BUG: WindowList Menu Does Not Always Show MDIChild Forms
ID: Q247359
|
The information in this article applies to:
-
Microsoft Visual Basic Standard, Professional, and Enterprise Editions, 16-bit and 32-bit, for Windows, version 4.0
-
Microsoft Visual Basic Learning, Professional, and Enterprise Editions for Windows, versions 5.0, 6.0
SYMPTOMS
When you open an MDIChild Form, it does not show in the WindowList. This occurs if you have a MDIChild form that is hidden, and the Windowstate of the MDIChild forms is Maximized.
RESOLUTION
Since this problem only occurs when closing maximized MDIChild forms, you need to set the form's Windowstate property to Normal for each MDIChild form before it is closed. This can be done in the MDIChild form's Unload event by setting its Visible property to False. Doing this sets the Windowstate of the form to Normal, while preserving the Windowstate of the MDIChild windows. This method is better than explicitly setting the Windowstate, because doing so also changes the WindowState of the other MDIChild Forms. Please refer to the sample code in the "More Information" section for a workaround.
STATUSMicrosoft has confirmed this to be a bug in the Microsoft products listed
at the beginning of this article.
MORE INFORMATION
Steps to Reproduce Behavior
- Open a new Standard EXE project in Visual Basic. Form1 is created by default
- From the Project menu add two more forms to the project (Form2 and Form3).
- Set the MDIChild property to True and the WindowState property to Maximized for Form1, Form2 and Form3.
- From the Project menu add an MDI Form to the project.
- Choose Menu Editor from the Tools menu in the Visual Basic IDE. Add a top level menu to the MDI Form. Give it the following property settings:
Caption Open
Name mnuMaster
Index 0
- Under this top level menu, create two submenus. Give the first submenu the following property settings:
Caption Form1
Name mnuOpen
Index 0
Give the second submenu the properties:
Caption Form2
Name mnuOpen
Index 1
- Add another top level menu, giving it the following properties:
Caption Window
Name mnuMaster
Index 1
WindowList Checked
At this point you should have a menu that looks like the following:
Open
...Form1
...Form2
Window
- Paste the following code into the General Declarations section of the MDI form's code window.
Private Sub MDIForm_Load()
Load Form1
Load Form2
Load Form3
Form3.Hide
End Sub
Private Sub mnuOpen_Click(Index As Integer)
Select Case Index
Case 0
Form1.Show
Case 1
Form2.Show
End Select
End Sub
- Run the Application. See Form1 and Form2 in the Windowlist, and Form2 will be the active window. Now close Form2.
- From the Open menu, select Form2. Form2 opens, but notice it is not showing in the Windowlist. Only Form1 shows in the WindowList.
- To work around the problem, add the following code to the form Unload event for each MDIChild Form. In our example, do this for Form1, Form2, and Form3.
Me.Visible = False
REFERENCES
For more information on creating menus, see the "Menu Basics" section in the MSDN.
Additional query words:
Keywords : kbMDI kbMenu kbVBp kbVBp400bug kbVBp500bug kbVBp600bug kbGrpVB kbDSupport
Version : WINDOWS:4.0,5.0,6.0
Platform : WINDOWS
Issue type : kbbug
|