Skip to main content

TcxTreeListPopupMenu.OnPopup Event

Enables you to prevent the context menu from being displayed, or to customize its contents.

Declaration

property OnPopup: TcxTreeListPopupMenuPopupEvent read; write;

Remarks

The table below lists event parameters:

Parameter Description
Sender Provides access to the TreeList control whose context menu is to be displayed.
AContextMenu Provides access to the context menu to be displayed. The menu type (built-in or custom context menu) depends upon the UseBuiltInMenu property value. Use the AContextMenu.BuiltInMenu or AContextMenu.PopupMenu property to access the built-in or custom menu and customize its contents. For instance, you can call the CreateMenuItem function to add custom items to the built-in menu.
AHandled Specifies whether the context menu should be displayed. Pass True as the AHandled parameter to prevent the context menu from being displayed.

The following code snippet represents the TreeList control’s PopupMenus.FooterMenu.OnPopup event handler of the SummariesDemo shipped with the ExpressQuantumTreeList Suite. This event handler adds custom items to the built-in footer context menu.

// Boolean fields storing the checked state of custom menu items
  FCheckBudget: Boolean;
  FCheckVacancies: Boolean;
procedure <Form>.<TreeList>PopupMenusFooterMenuPopup(
  Sender: TcxCustomTreeList; AContextMenu: TcxTreeListPopupMenu;
  var AHandled: Boolean);
begin
  AContextMenu.CreateMenuItem(AContextMenu.Root, 'Budget exceeds 100000', tlcmUser, True, tlmitChecked, FCheckBudget, -1, True);
  AContextMenu.CreateMenuItem(AContextMenu.Root, 'Department has vacancies', tlcmUser + 1, True, tlmitChecked, FCheckVacancies);
  //...
  // The AHandled parameter is not changed, so that the modified
  // context menu can be displayed
end;
See Also