Skip to main content

TcxTreeListPopupMenu.CreateMenuItem(TComponent,string,TcxTag,Boolean,TcxTreeListBuiltInMenuItemType,Boolean,Integer,Boolean) Method

Adds an item to the built-in context menu.

Declaration

function CreateMenuItem(AOwner: TComponent; const ACaption: string; ACommand: TcxTag; AEnabled: Boolean = True; AItemType: TcxTreeListBuiltInMenuItemType = tlmitDefault; AChecked: Boolean = False; AImageIndex: Integer = -1; AWithSeparator: Boolean = False): TComponent;

Parameters

Name Type
AOwner TComponent
ACaption string
ACommand TcxTag
AEnabled Boolean
AItemType TcxTreeListBuiltInMenuItemType
AChecked Boolean
AImageIndex Integer
AWithSeparator Boolean

Returns

Type
TComponent

Remarks

The table below lists function parameters:

Parameter

Description

AOwner

Specifies the parent menu item for the item being added. To add the item to the menu’s root, pass the menu’s Root property value as this parameter.

ACaption

Specifies the caption of the menu item being added.

ACommand

Specifies the identity value of the command associated with the menu item being added. For your convenience, use the tlcmUser global constant as the base for your command identity values. To associate your menu item with one of the standard built-in commands, pass the corresponding tlcm~ constant value as the ACommand parameter. Refer to the TcxTreeListColumnHeaderPopupMenu.Items and TcxTreeListFooterPopupMenu.Items topics, to learn about the correspondence between standard built-in commands and tlcm~ constants.

The specified ACommand parameter value is assigned to the menu item’s Tag property. So, you can distinguish menu items using this property value.

AEnabled

Specifies the menu item’s enabled state. Pass False as this parameter to disable the item.

AItemType

Specifies the menu item’s type. Refer to the TcxTreeListBuiltInMenuItemType type description to learn about available item types.

AImageIndex

Specifies the image within the UserImages collection for the menu item being added. -1 indicates that no image is associated with the menu item.

AWithSeparator

Specifies whether a separator precedes the menu item being added.

To dynamically add items to the built-in context menu, handle the OnPopup event. To respond to clicks on menu items, handle the OnClick event.

See Also