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

# TPopupMenu

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

TPopupMenu - a menu panel that pops up on the desktop when the right mouse button is clicked

## Declaration

Source position: menus.pp line 388

`type TPopupMenu = class(TMenu)`
``
`class procedure WSRegisterClass; override;` |  | WSRegisterClass - Register this Class for the current Widget Set
`protected`
`procedure DoPopup(); virtual;` |  | DoPopup perform the popup method
`procedure DoClose; virtual;` |  | DoClose - perform the Close method
`public`
`constructor Create(); override;` |  | Create - constructor for TPopupMenu: calls inherited Create, sets style to PopupMenu, sets AutoPopup to True
`destructor Destroy; override;` |  | Destroy - destructor for TPopupMenu: closes window then calls inherited Destroy
`procedure PopUp();` |  | PopUp - sofware emulation of the OnPopup event
`property PopupComponent: TComponent; [rw]` |  | PopupComponent - the Component to which this popup applies
`property PopupPoint: TPoint; [r]` |  | PopupPoint - the position at which the Popup is to appear
`procedure Close;` |  | Close - software emulation of the OnClose event, to shut down the Popup
`published`
`property Alignment: TPopupAlignment; [rw]` |  | Alignment - determines the position of popup menu relative to the popup coordinate
`property AutoPopup: Boolean; [rw]` |  | AutoPopup - if True, the Popup window automatically appears when the mouse hovers over the relevant object
`property HelpContext: THelpContext; [rw]`
`property TrackButton: TTrackButton; [rw]` |  | TrackButton - defines which mouse button(s) are allowed to activate menu items
`property OnPopup: TNotifyEvent; [rw]` |  | OnPopup - event handler for a requirement for a popup menu
`property OnClose: TNotifyEvent; [rw]` |  | OnClose - event handler for closing down the popup
`end;`

## Inheritance

`TPopupMenu` |  | TPopupMenu - a menu panel that pops up on the desktop when the right mouse button is clicked
`TMenu` |  | TMenu : The base class for all menus
`TLCLComponent` |  | TLCLComponent - base class for LCL components
`TComponent,IUnknown,IInterfaceComponentReference`
`TPersistent`
`TObject`

## Description

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

Inherits all the properties of TMenu (including the properties of TMenuItem), but has some new properties (procedure PopUp and procedure Close) that define its behaviour when actually invoked.

PopupPoint defines the position of the Popup menu, usually at the current cursor position.

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

## See also

HowToUseMenus |  | HowToUseMenus - hints for creating Menus for your Forms
TMainMenu |  | TMainMenu - the Main Menu that appears at the top of most windows
TMenuItem |  | TMenuItem - The base structure of each item in a Menu.
TMenu |  | TMenu : The base class for all menus
TMenuActionLink |  | TMenuActionLink: defines the link between a selected menu item and its corresponding action

The latest version of this document can be found at lazarus-ccr.sourceforge.net.