[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'Menus' (#lcl)

# TPopupMenu

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Implements a menu panel that pops up on the screen when the right mouse button is clicked.

## Declaration

Source position: menus.pp line 465

`type TPopupMenu = class(TMenu)`
`protected`
`class procedure WSRegisterClass; override;` |  | Registers this component class with the current WidgetSet.
`procedure DoPopup(); virtual;` |  | Performs actions needed to display the pop-up menu.
`procedure DoClose; virtual;` |  | Performs actions needed when the pop-up menu is closed.
`procedure SetPopupPoint();` |  | Sets the value for the PopupPoint property.
`public`
`constructor Create(); override;` |  | Constructor for the class instance.
`destructor Destroy; override;` |  | Destructor for the class instance.
`procedure PopUp();` |  | Displays the pop-up menu.
`property PopupComponent: TComponent; [rw]` |  | Component to which the pop-up menu is attached.
`property PopupPoint: TPoint; [rw]` |  | TPoint instance with the coordinates where the pop-up menu is displayed.
`procedure Close;` |  | Closes the pop-up menu when it is active.
`published`
`property Alignment: TPopupAlignment; [rw]` |  | Determines the position of pop-up menu relative to the pop-up coordinate.
`property AutoPopup: Boolean; [rw]` |  | Indicates if the pop-up is displayed when the mouse hovers over the component for the pop-up menu.
`property HelpContext: THelpContext; [rw]` |  | Help context for the pop-up menu.
`property TrackButton: TTrackButton; [rw]` |  | Identifies the mouse button which activated the pop-up menu.
`property OnPopup: TNotifyEvent; [rw]` |  | Event handler signalled to display the pop-up menu.
`property OnClose: TNotifyEvent; [rw]` |  | Event handler signalled when the pop-up menu is closed.
`end;`

## Inheritance

`TPopupMenu` |  | Implements a menu panel that pops up on the screen when the right mouse button is clicked.
`TMenu` |  | TMenu - a menu appearing in a form. Base class for TMainMenu or TPopupMenu.
`TLCLComponent` |  | The base class for LCL components which have an associated widget.
`TComponent`
?
`TObject`

## Description

TPopupMenu is a menu panel that pops up on the screen when the right mouse button is clicked.

TPopupMenu inherits all the properties of TMenu (including the properties of TMenuItem), but has some new methods (procedure PopUp and procedure Close) that define its behavior when invoked.

PopupPoint defines the position of the pop-up menu, usually at the current cursor position.

To use a pop-up menu, first create it with the MenuEditor. Then with the Object Inspector for the control that needs to use the Pop-up, select the property named PopupMenu, and a list box will appear with the names of the available Menus - choose the Pop-up name you want.

## Version info

TPopupMenu for the Windows platform was modified in LCL version 2.2.6. It no longer uses the highlighted drawing effect when drawing the glyph icon for an enabled menu item. The normal drawing effect is used instead.

## See also

TMainMenu |  | TMainMenu - the Main Menu that appears at the top of most windows.
TMenuItem |  | Represents a menu item displayed in a menu.
TMenu |  | TMenu - a menu appearing in a form. Base class for TMainMenu or TPopupMenu.
TMenuActionLink |  | TMenuActionLink: defines the link between a selected menu item and its corresponding action.
How To Use Menus |  | HowToUseMenus - hints for creating Menus for your Forms.