A menu is considered, or qualifies as, popup if, or because, it can appear anywhere on the form as the programmer wishes. Such a menu is also referred to as context-sensitive because its appearance and behavior depends on where it displays on the form or on a particular control.
The first difference between a main menu and a popup menu is that a popup menu appears as one category or one list of items and not like a group of categories of menus like a main menu. Secondly, while a main menu by default is positioned on the top section of a form, a popup menu doesn't have a specific location on the form.
To use a popup menu, usually the user can right-click the section of the form or the object on which the menu is configured to appear.
A popup menu is based on the ContextMenu class. To visually create a popup menu, on the
Toolbox, click the ContextMenu button and click on the form. Once you have a
ContextMenu object, you can create its menu items. To do this,
click the ContextMenu box to display the first Type Here line and
configure the menu item as you would proceed with a menu item on the main
menu.
Unlike a main menu, a popup menu provides a single list of items. If you want different popup menus for your form, you have two options. You can create various popup menus or programmatically change your single popup menu in response to something or some action on your form.
There is nothing particularly specific with writing code for a popup menu item. You approach it exactly as if you were dealing with a menu item of a main menu. You can write code for an item of a popup menu independent of any other item of a main menu. If you want an item of a popup menu to respond to the same request as an item of a main menu, you can write code for one of the menu items (either the item on the main menu or the item on the popup menu) and simply call its
Click event in the event of the other menu item |