Sign in Join
FPDoc Onlineexperiment

NewItem function

In unit Menus

Creates and configures a new menu item instance.

Declaration

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

ACheckedTrue if the new menu item is checked.
TheEnabledTrue 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

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.