Providing a Pop-up Menu
Go Up to Working with controls Index
Pop-up, or local, menus are a common ease-of-use feature for any application. They enable users to minimize mouse movement by clicking the right mouse button in the application workspace to access a list of frequently used commands.
In a text editor application, for example, you can add a pop-up menu that repeats the Cut, Copy, and Paste editing commands. These pop-up menu items can use the same event handlers as the corresponding items on the Edit menu. You don't need to create accelerator or shortcut keys for pop-up menus because the corresponding regular menu items generally already have shortcuts.
A form's PopupMenu property specifies what pop-up menu to display when a user right-clicks any item on the form. Individual controls also have PopupMenu properties that can override the form's property, allowing customized menus for particular controls.
To add a pop-up menu to a form
- Place a pop-up menu component on the form.
- Use the Menu Designer to define the items for the pop-up menu.
- Set the PopupMenu property of the form or control that displays the menu to the name of the pop-up menu component.
- Attach handlers to the OnClick events of the pop-up menu items.