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

# NewItem

Creates and configures a new menu item instance.

## Declaration

Source position: menus.pp line 515

`function NewItem(`
`const ACaption: string;`
`AShortCut: TShortCut;`
`AChecked: Boolean;`
`TheEnabled: Boolean;`
`TheOnClick: TNotifyEvent;`
`hCtx: THelpContext;`
`const AName: string`
`):TMenuItem;`

## Arguments

`ACaption` |  | Caption text for the new menu item.
`AShortCut` |  | Short cut for the new menu item.
`AChecked` |  | True if the new menu item is checked.
`TheEnabled` |  | True if the new menu item is enabled.
`TheOnClick` |  | OnClick handler for the new menu item.
`hCtx` |  | Help context for the new menu item.
`AName` |  | Name assigned for the new menu item.

## Function result

Menu item instance created in the routine.

## Description

NewItem is a TMenuItem function used to create and configure a new menu item instance using the values passed in the arguments to the routine. The TMenuItem instance is created with its Owner property set to Nil. Values passed in the parameters are assigned to the corresponding properties in the TMenuItem instance in the return value.

Other property values for the menu item can be assigned in the calling routine. Use the Add or Insert method in the desired menu or sub menu to store the new menu item instance.

## See also

TMenu.Items |  | Contains the menu items displayed on the menu.
TMenuItem |  | Represents a menu item displayed in a menu.
TMenuItem.Items |  | Provides indexed access to the child menu items for the current class instance.
TMenuItem.Add |  | Adds item(s) to the menu item.
TMenuItem.Insert |  | Insert stores the specified menu item at the location indicated by Index.