Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


MDI's menu overwritten by child form's menu

Posted on 1998-12-01
Medium Priority
Last Modified: 2008-02-26
Hi, experts: I have question on how to resolve MDI's menu which overwritten by child form's menu. I would like to display MDI menu throught the whole period and display child form's menu on child form. If there is a way can resolve this problem, please let me know, better yet include your example code. Thanks in advances.
Question by:zli102698
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

tward earned 90 total points
ID: 1447620
Straight from the knowledge base:

Menus in MDI Applications

In an MDI application, the menus for each child are displayed on the MDI form, rather than on the child forms themselves. When a child form has the focus, that child's menu (if any) replaces the MDI form's menu on the menu bar. If there are no child forms visible, or if the child with the focus does not have a menu, the MDI form's menu is displayed (see Figures 6.14 and 6.15).

It is common for MDI applications to use several sets of menus. When the user opens a document, the application displays the menu associated with that type of document. Usually, a different menu is displayed when no child forms are visible. For example, when there are no files open, Microsoft Excel displays only the File and Help menus. When the user opens a file, other menus are displayed (File, Edit, View, Insert, Format, Tools, Data, Window, and so on).

Creating Menus for MDI Applications
You can create menus for your Visual Basic application by adding menu controls to the MDI form and to the child forms. One way to manage the menus in your MDI application is to place the menu controls you want displayed all of the time, even when no child forms are visible, on the MDI form. When you run the application, the MDI form's menu is automatically displayed when there are no child forms visible, as shown in Figure 6.14.

Figure 6.14   The MDI form menu is displayed when no child forms are loaded

Place the menu controls that apply to a child form on the child form. At run time, as long as there is at least one child form visible, these menu titles are displayed in the menu bar of the MDI form.

Some applications support more than one type of document. For example, in Microsoft Access, you can open tables, queries, forms, and other document types. To create an application such as this in Visual Basic, use two child forms. Design one child with menus that perform spreadsheet tasks and the other with menus that perform charting tasks.

At run time, when an instance of a spreadsheet form has the focus, the spreadsheet menu is displayed, and when the user selects a chart, that form's menu is displayed. If all the spreadsheets and charts are closed, the MDI form's menu is displayed. For more information on creating menus, see "Using Menus in Your Application" earlier in this chapter.

Creating a Window Menu
Most MDI applications (for example, Microsoft Word for Windows and Microsoft Excel) incorporate a Window menu. This is a special menu that displays the captions of all open child forms, as shown in Figure 6.15. In addition, some applications place commands on this menu that manipulate the child windows, such as Cascade, Tile, and Arrange Icons.

Figure 6.15   The Window menu displays the name of each open child form

Any menu control on an MDI form or MDI child form can be used to display the list of open child forms by setting the WindowList property for that menu control to True. At run time, Visual Basic automatically manages and displays the list of captions and displays a check mark next to the one that had the focus most recently. In addition, a separator bar is automatically placed above the list of windows.

To set the WindowList property

Select the form where you want the menu to appear, and from the Tools menu, choose Menu Editor.
Note   The WindowList property applies only to MDI forms and MDI child forms. It has no effect on standard (non-MDI) forms.

In the Menu Editor list box, select the menu where you want the list of open child forms to display.

Select the WindowList check box.
At run time, this menu displays the list of open child forms. In addition, the WindowList property for this menu control returns as True.

For More Information   See "WindowList Property" in the Language Reference.

Arranging Child Forms
As was mentioned earlier, some applications list actions such as Tile, Cascade, and Arrange Icons on a menu, along with the list of open child forms. Use the Arrange method to rearrange child forms in the MDI form. You can display child forms as cascading, as horizontally tiled, or as child form icons arranged along the lower portion of the MDI form. The following example shows the Click event procedures for the Cascade, Tile, and Arrange Icons menu controls.

Private Sub mnuWCascade_Click ()
   ' Cascade child forms.
   frmMDI.Arrange vbCascade
End Sub

Private Sub mnuWTile_Click ()
   ' Tile child forms (horizontal).
   frmMDI.Arrange vbTileHorizontal
End Sub

Private Sub mnuWArrange_Click ()
   ' Arrange all child form icons.
   frmMDI.Arrange vbArrangeIcons
End Sub

Note   The intrinsic constants vbCascade, vbTileHorizontal, and vbArrangeIcons are listed in the Visual Basic (VB) object library of the Object Browser.

When you tile or cascade child forms that have a fixed border style, each child form is positioned as if it had a sizable border. This can cause child forms to overlap.


Author Comment

ID: 1447621
Tward: thanks for suggestions. It look like there is no easy we can display both MDI and Child Form's menu. Please take the points.

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article ( for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

704 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question