Providing a Pop-up Menu

From RAD Studio
Jump to: navigation, search

Go Up to Working with Text in Controls

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 the 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

  1. Place a pop-up menu component on the form.
  2. Use the Menu Designer to define the items for the pop-up menu.
  3. Set the PopupMenu property of the form or control that displays the menu to the name of the pop-up menu component.
  4. Attach handlers to the OnClick events of the pop-up menu items.

See Also