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

# NewMenu

Creates and configures a new menu instance with the specified menu items.

## Declaration

Source position: menus.pp line 507

`function NewMenu(`
`Owner: TComponent;`
`const AName: string;`
`const Items: array of TMenuItem`
`):TMainMenu;`

## Arguments

`Owner` |  | Component which owns the new menu instance.
`AName` |  | Name for the new menu instance.
`Items` |  | Array with the menu items for the new menu instance.

## Function result

TMainMenu instance created in the routine.

## Description

NewMenu is a TMainMenu function used to create and configure a new menu instance using the values passed in the arguments to the routine. The return value is a TMainMenu instance created using the component in Owner as the owner for the class instance. The value in AName is used in the Name property for the new menu instance.

NewMenu 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.