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

# TMenuItem.Add

Adds item(s) to the menu item.

## Declaration

Source position: menus.pp line 279

`public procedure TMenuItem.Add(`
`Item: TMenuItem`
`); procedure TMenuItem.Add(`
`const AItems: array of TMenuItem`
`);`

## Arguments

`Item` |  | Menu item added to the child Items.

## Arguments

`AItems` |  | Array of menu items added to the child Items.

## Description

Add is an overloaded method used to add one or more items to the menu. Variants are provided that allow a single TMenuItem instance to be added, or an array of TMenuItem instances.

The single menu item variant calls Insert to store the value in Item at the position in the Count property. Insert will increment the value in Count.

The array variant iterates over each of the elements in the array, and calls Add to store the menu instances in Items.

Remark: | Adding a child menu item that is a Separator may crash the application on non-Windows platforms. Use the AddSeparator method instead.

## See also

TMenuItem.Insert |  | Insert stores the specified menu item at the location indicated by Index.
TMenuItem.Count |  | Number of child menu items stored in the Items property.
TMenuItem.Caption |  | The caption text displayed for the menu item.
TMenuItem.AddSeparator |  | Adds a separator line to the child menu items.