1. Technology
Send to a Friend via Email
Migrating the Menu to VB .NET
Part 3: The Other VB 6 Menu Editor Options
 More of this Feature
• Part 1: VB 6 and VB .NET Menu Programming
• Part 2: Entering the Event Code for the Menu
• Part 4: VB .NET Menu Creation
• Part 5: The About Visual Basic Menu
 
 Related Resources
• User Interfaces in VB .NET
An About Visual Basic Review
 

The other items in the VB 6 Menu Editor are for special requirements for menus. Index allows you to program the menu items as part of a control array. Shortcut lets you select a keyboard combination for the menu item. HelpContextID ties this menu item to a particular Help topic - assuming that you have created a Help file for the system. And Checked just places a check mark by the menu items when it's selected. The last two, NegotiatePosition and WindowList, are more interesting.

Although you don't see it very often, ActiveX documents can actually have their own menu and when they do, the menu for the ActiveX document has to be included into the same space as the menu for the host window. The process of deciding where the ActiveX menu is placed is called Negotiation. The NegotiatePostion property can have a value from 0 to 3 and specifies how the two menus are merged.

WindowList tells the Editor to display the list of MDI (Multiple Docuement Interface) child windows in the menu. Once you create the MDI windows, placing them in this menu is simply a matter of checking the box. Here's what the result looks like:

MDI WindowList

Creating "popup menus" (or, as they're called today, Context Menus) is easy enough to do, but has to be done in code (although the menu itself has to be created at design time using the Menu Editor). Here's an example:

Popup Window

Notice that the menu is the same one we created before, but it's displayed using a program call. If you don't want the menu to be visible at the top of the form, set the Visible property to False (or uncheck the box in the Menu Editor).

If you want to do anything else with menus in VB 6 ... well ... you pretty much have to go for Win32 API calls. And they're not well documented. If you're a C++ programmer, you can find the calls in C:\Program Files\Microsoft Visual Studio\VC98\Include\userinfo\WINUSER.H. But using that information is a topic all by itself. If you want to go for it, a good reference can be found in Dan Appleman's Programmers Guide to the Win32 API.

VB 6 gives you very useful and fairly easy-to-use menu components. The fact that you have to dive into a C++ programming style to do anything that goes beyond the relatively simple menu capabilities provided by the Menu Editor points right to the difference between VB 6 and VB .NET.

More about those differences on the next page ...

Next page > VB .NET Menu Creation > Page 1, 2, 3, 4, 5

©2014 About.com. All rights reserved.