To increase the functionality of a Visual Basic application, menu bars provide
the user with a simple way of controlling the program. The menu bar is at the
top of a form window in most applications. Visual Basic provides a Menu Editor
that simplifies the creation of menus. Once created these menus can be individually
programmed to respond when selected.
Another type of menu quite popular with users
is the pop-up menu. This menu can be very specific
to certain controls or areas of the application.
These menus are often called context-sensitive
menus.
To provide the user with customized menu options,
menus can also be created at runtime. The Most
Recently Used File list is a good example of
how dynamic menus customize an application based
on
the user's needs. These menus provide
runtime assistance that can vary depending on
a user's preferences.
This chapter covers the following topics:
- Menu basics
- Menu terminology
- Using the Menu Editor
- Dynamically modifying the appearance of a menu
- Changing the menu's properties at runtime
- Adding a pop-up menu to an application
- Defining the pop-up menu
- Determining the mouse button
- Displaying the pop-up menu
- Controls with pop-up menus
- Creating an application that adds and deletes menus at runtime
- Creating runtime menu items
- Coding for runtime menu items
- Removing runtime menu items
- Adding controls to forms
- Setting properties for CommandButtons, TextBoxes, and Labels
- Assigning code to a control to respond to an event