DesignEditors.TComponentEditor.PrepareItem

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

procedure PrepareItem(Index: Integer; const AItem: IMenuItem); virtual;

C++

virtual void __fastcall PrepareItem(int Index, const Designmenus::_di_IMenuItem AItem);

Properties

Type Visibility Source Unit Parent
procedure
function
public
DesignEditors.pas
DesignEditors.hpp
DesignEditors TComponentEditor

Description

Allows the component editor to modify menu items as they are added to the context menu.

The form designer calls PrepareItem for each verb when it constructs the context menu. This method lets the component editor make any modifications to the menu item for each verb, including adding subitems or removing the item from the context menu.

Index identifies the current verb that the form designer is adding to the context menu. This is the same index as appears for the command in the GetVerb and ExecuteVerb methods.

AItem is an interface to the menu item created by the form designer for the current verb. To add subitems, call the AddItem method of this interface. To disable the item, set the Enabled property to false. To suppress the menu item altogether, set its Visible property to false.

As implemented in TComponentEditor, PrepareItem does nothing. Override this method to customize the context menu before it is displayed.

See Also