Skip to main content

TcxPopupMenuInfo Class

Contains information on the custom popup menu contained in the TcxGridPopupMenu component.

Declaration

TcxPopupMenuInfo = class(
    TCollectionItem
)

Remarks

The TcxGridPopupMenu component allows you to create custom popup menus for grid Views both at design time and runtime. At design time you can use the TcxGridPopupMenu.PopupMenus property editor to add a new menu.

and setup them

At runtime, you can add the popup menu using the TcxGridPopupMenu.RegisterPopupMenu method.

First, you should create an OnPopup event handler.

procedure TForm1.cxGridPopupMenu1Proc(ASenderMenu: TComponent; AHitTest: TcxCustomGridHitTest; X, Y: Integer);
begin
  PopupMenu1.Popup(X, Y);
end;

The following code assumes that you are adding the standard VCL popup menu (TPopupMenu). Keep in mind that the popup menu will not appear as expected unless you add the following code into your TcxPopupMenuInfo.OnPopup event handler.

PopupMenu1.Popup(X, Y);

Now you are ready to add a custom popup menu to the collection. The code below adds a new TcxPopupMenuInfo class instance to the TcxPopupMenuInfos collection and sets its properties to the values specified by the TcxGridPopupMenu.RegisterPopupMenu method parameters.

cxGidPopupMenu1.RegisterPopupMenu(PopupMenu1, [gvhtCell], cxGridPopupMenu1Proc, cxGrid1DBTableView1);

Menu settings you add to the TcxGridPopupMenu component are TcxPopupMenuInfo objects. The component’s PopupMenus property (a TcxPopupMenuInfos collection) provides access to these menu settings.

The TcxPopupMenuInfo class provides all the necessary properties for proper popup menu display. These include:

  • GridView. Specifies the grid View to associate with the popup menu.

  • HitTypes. Specifies the grid View elements to which the popup menu can be applied.

  • OnPopup. Specifies the popup event. The menu will not appear unless you properly handle this event.

Inheritance

See Also