DOCUMENT:Q126675 02-NOV-2001 [vbwin] TITLE :BUG: Menu Lost if Caption Changed on Menu with Only WindowList PRODUCT :Microsoft Visual Basic for Windows PROD/VER::3.0 OPER/SYS: KEYWORDS: ====================================================================== ------------------------------------------------------------------------------- The information in this article applies to: - Microsoft Visual Basic Standard Edition for Windows, version 3.0 - Microsoft Visual Basic Professional Edition for Windows, version 3.0 ------------------------------------------------------------------------------- SYMPTOMS ======== When a top-level menu has its WindowList property set to True and the top- level menu does not contain any sub-menus, after changing the menu's caption the top-level menu will no longer display the list of MDI child windows and you will not receive any click events. RESOLUTION ========== In order to work around the problem, make sure the top-level menu item that has the WindowList property set to True has at least 1 sub-menu item. STATUS ====== Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available. MORE INFORMATION ================ In the example below, a menu on the MDI form contains nothing but a WindowList. A command button is placed on the MDI child form with code behind it to change the caption of the menu containing the WindowList. As long as you do not click on the command button, the Window menu will display a list the MDI child windows. Once you click on the command button, the Window menu caption is changed to "Test" and it no longer keeps track of the MDI child windows and it no longer receives click events. NOTE: Issuing the command "Print MDIForm1.mnuwindow.Windowlist" (without the quotes) from the immediate window will return -1 (True). However, the Window list is not displayed. Steps To Recreate The Problem ----------------------------- 1. Start a new project in Visual Basic (ALT, F, N). Form1 is created by default. 2. From the Property Window, set MDIChild equal to True for Form1. 3. Add a Command button (Command1) to Form1 and add the following code to the Click event. Sub Command1_Click () MDIForm1.mnuWindow.Caption = "Test" End Sub 4. From the File menu, select New MDI Form. MDIForm1 is created by default. 5. From the Window menu, choose Menu Design. 6. Create a menu for the MDI Form with the following properties: Caption Name Indented WindowList ------------------------------------------- File mnuFile No Unchecked New mnuNew Once Unchecked Window mnuWindow No Checked 7. Choose Done to exit the Menu Design Window. You now have two top-level menus. 8. Add the following code to the Click event of mnuNew menu on MDIForm1. Sub mnuNew_Click () Dim f As New Form1 f.Show End Sub 9. Press F5 to run the program. 10. The Window menu will keep track of all the MDIChild windows as long as you do not click Command1 contained in the MDIChild. Once you click on the command button, the Window menu's caption has changed to "Test" and it will no longer list any of the MDIChild windows and you will not receive any click events. Additional query words: 3.00 buglist3.00 ====================================================================== Keywords : Technology : kbVBSearch kbAudDeveloper kbZNotKeyword6 kbZNotKeyword2 kbVB300Search kbVB300 Version : :3.0 Issue type : kbbug ============================================================================= THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY. Copyright Microsoft Corporation 2001.