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

# NewPopupMenu

Creates and configures a new pop-up menu with the specified menu items.

## Declaration

Source position: menus.pp line 509

`function NewPopupMenu(`
`Owner: TComponent;`
`const AName: string;`
`Alignment: TPopupAlignment;`
`AutoPopup: Boolean;`
`const Items: array of TMenuItem`
`):TPopupMenu;`

## Arguments

`Owner` |  | Component which owns the new pop-up menu instance.
`AName` |  | Name for the new pop-up menu instance.
`Alignment` |  | Alignment relative to the mouse pointer for the pop-up menu instance.
`AutoPopup` |  | True if the pop-up menu is automatically displayed when the mouse is hovered over the component.
`Items` |  | Array with the menu items for the new pop-up menu instance.

## Function result

TPopUpMenu instance created in the routine.

## Description

NewPopupMenu is a TPopUpMenu function used to create and configure a new pop-menu with the values specified in the arguments to the routine. The return value is created using the component in Owner as the owner of the class instance. The value in AName is used in the Name property for the new menu instance. AutoPopUp and Alignment are assigned to the corresponding properties in the new pop-up menu instance.

NewPopupMenu calls an implementation routine to add the menu Items to the new menu instance. It ensures that the Owner for the menu items are updated to reflect the Owner for the new menu instance, and that they are inserted into the Owner component.