Freetutes.com

VB6 beginners tutorial - Learn VB6

Advanced VB6 tutorial - Learn Advanced VB6

Systems Analysis - System analysis and Design tutorial for Software Engineering


You are here: Visual Basic > Advanced VB6 tutorial > Chapter 3

Defining the Pop-Up Menu

To create a pop-up menu, a top-level menu item is used. This item can be part of the normal menu structure seen by the user, or it can have its Visible property set to False so that it does not appear with the regular menu(as shown in Figure 3.5).

All items on the pop-up menu are created as sub-level items of the invisible top-level menu. Each sub-menu item can have its properties set as required.

When the pop-up menu is needed, the PopupMenu method is called to activate the pop-up menu. The following code demonstrates this:

Form1.PopupMenu mnuPopUp1


FIGURE 3.5. design time view of menu system with a pop-up menu.

This preceding code calls the PopupMenu method of Form1, as shown in Figure 3.6. The menu item mnuPopUp1 is passed as an argument and is displayed at the current mouse location. This code assumes that a menu system has been created and a menu item named mnuPopUp1 exists.

The PopupMenu method accepts the name of the menu to activate, arguments that indicate the orientation of the menu (left, center, and right), and the screen coordinates for display and other options.

Runtime view of a custom pop-up menu.
FIGURE 3.6 - Runtime view of a custom pop-up menu.


  

<< Previous | Contents | Next >>

Home | About Us | Privacy Policy | Contact Us

Copyright © Freetutes.com | All Rights Reserved