Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

TcxTreeListPopupMenu.OnPopup Event

In This Article

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

#Declaration

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

Delphi
// 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