Problem Hiding Menus when MDI Child CombineTitle=True

ID Number: Q85153

1.00

WINDOWS

buglist1.00

Summary:

When using menus with an MDI Child custom control and with the MDI

Child CombineTitle property set to True (-1), incorrect results can

occur when hiding a menu item (that is, setting a menu item's Visible

property to False.) The wrong menu item is hidden, even though the

Visible property for the correct menu item is explicitly set to False

(0). This problem does not occur when the MDI Child control

CombineTitle property is set to False.

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.

To work around this problem, temporarily set the CombineTitle property

of any maximized MDI Child control to False before hiding menu items.

More Information:

Steps to Reproduce Problem

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

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 MDIChild tool appears in the

Toolbox.

3. Place an MDI Child window (MDIChild1) on Form1. In the Properties

list box, select the CombineTitle property. In the Settings box,

select False.

4. Create a menu for Form1. (For information on how to do this, see

pages 110-111 in the "Microsoft Visual Basic: Programmer's Guide"

version 1.0 manual.) Use the following menu definition:

Menu 1 '<- Name this control "M1"

...Hide Menu 3 '<- Name this control "Item1"

...Restore Menu 3 '<- Name this control "Item2"

Menu 2 '<- Name this control "M2"

Menu 3 '<- Name this control "M3"

5. Add the following code to Form1:

Sub Form_Click ()

MDIChild1.CombineTitle = -1

End Sub

Sub Item1_Click ()

M3.Visible = 0 'Hide Menu 3

End Sub

Sub Item2_Click ()

M3.Visible = -1 'Restore Menu 3

End Sub

6. Press F5 to run the code.

7. Click on Menu 1 and select Item1 (Hide Menu 3). Notice that Menu

3 disappears from the menu bar.

8. Restore Menu 3 by clicking Item2 (Restore Menu 3).

9. Maximize MDIChild1 by clicking its Maximize button in the top

right corner of the child window. The CombineTitle property

determines whether the child window title is combined with the

parent form title. If the CombineTitle property is set to True,

the title of the parent form and the title of the child window

combine and display in the parent form title area. If the property

is set to False, the titles will not combine. (For more

information on CombineTitle, see page 188 in the "Microsoft

Microsoft Professional Toolkit for Visual Basic: Custom Control

Reference.")

Because the property was initially set to False at design time,

the child window's title bar will display underneath the menu bar,

and the Menu 1 selections will work correctly.

10. Minimize MDIChild1 by clicking its Maximize button once more.

Notice that it returns to its original size.

11. Click on Form1 to change the MDIChild1 CombineTitle property to

True. Maximize MDIChild1 again, and choose Hide Menu 3 from the

Menu 1 menu. Notice that instead of Menu 3 disappearing, Menu 2

disappears instead. If you choose Restore Menu 3 from Menu 1, a

duplicate copy of Menu 3 appears to the right MDIChild1 Minimize/

Maximize buttons.

Additional reference words: 1.00