Skip to main content

TcxPopupMenuLayout.MenuItems Property

Specifies visible items in the image editor context menu.

Declaration

property MenuItems: TcxPopupMenuItems read; write; default [pmiCut, pmiCopy, pmiPaste, pmiDelete, pmiLoad, pmiWebCam, pmiSave, pmiEdit];

Property Value

Type Description
TcxPopupMenuItems

The current set of pop-up menu items.

Remarks

Use the MenuItems property to hide or display individual menu items. The image editor context menu initially displays the following items:

VCL Editors Library: The Default Context Menu

Cut | Copy | Paste

Execute corresponding clipboard operations with images.

Alternatively, you can use standard Ctrl + X, Ctrl + C, and Ctrl + V key combinations.

Delete
Deletes the displayed image.
Load
Allows you to load a supported image from the file system.
Assign From Camera…
Displays the Camera Preview dialog. This option is enabled only if at least one camera is available to the camera manager.
Save As…
Displays the Save As… dialog.
Edit…
Displays the Image Editor Dialog.

Note

The Assign From Camera… item that displays the Camera Preview dialog is enabled only if at least one camera is available to the camera manager.

Add and Configure a Custom Item

To create a custom item in the image editor context menu, add the pmiCustom flag to the MenuItems property value. The new item is displayed at the bottom of the context menu. A separator line delimits the custom item from built-in items.

You can use CustomMenuItemCaption and CustomMenuItemGlyph properties to define captions and glyphs for the new item.

Code Example: Context Menu Customization

The following code example removes the predefined Assign From Camera… item and adds a custom menu item:

var
  AMenuLayout: TcxPopupMenuLayout;
begin
  AMenuLayout := cxImage1.Properties.PopupMenuLayout;
  AMenuLayout.MenuItems := AMenuLayout.MenuItems - [pmiWebCam]; // Removes the "Assign from Camera..." item
  AMenuLayout.MenuItems := AMenuLayout.MenuItems + [pmiCustom]; // Adds a custom menu item at the bottom
  AMenuLayout.CustomMenuItemCaption := 'Custom Menu Item';
end;

VCL Editors Library: A Custom Context Menu Example

Add Custom Item Functionality

To respond to a click on the configured custom menu item, handle the target image editor’s Properties.OnCustomClick event:

procedure TMyForm.cxImage1PropertiesCustomClick(Sender: TObject)
begin
  ShowMessage('My message');
end;

Default Value

The MenuItems property’s default value is [pmiCut, pmiCopy, pmiPaste, pmiDelete, pmiLoad, pmiWebCam, pmiSave, pmiEdit].

See Also