Back to Devexpress

How to Associate TdxBarPopupMenu with Controls

vcl-155070-expressbars-how-to-associate-a-tdxbarpopupmenu-with-controls.md

latest1.9 KB
Original Source

How to Associate TdxBarPopupMenu with Controls

  • Aug 02, 2022

You can associate a TdxBarPopupMenu with any control on a form. This popup menu will be displayed by right-clicking the appropriate control.

You should use the PopupMenuLinks property of a TdxBarManager object in order to connect a control and a TdxBarPopupMenu.

Follow these steps to associate a control with a TdxBarPopupMenu at design time:

  1. Select a bar manager in the Object Inspector.

  2. Press the ellipsis button (‘…’) in the PopupMenuLinks edit field to display a standard collection editor with a list all existing menu links.

  1. Using this editor you can manage elements within the PopupMenuLinks collection and associate a control with a menu link using the menu link’s TdxBarPopupMenu.Control property.

Note

If a control is associated with several TdxBarPopupMenu objects, it only uses the top menu from the links menu. All the rest are ignored.

The code below demonstrates how you can associate a TEdit with a TdxBarPopupMenu programmatically:

delphi
// ...
var
  NewMenuLink : TdxBarPopupMenuLink;
begin
  NewMenuLink := dxBarManager1.PopupMenuLinks.Add;
  NewMenuLink.Control := Edit1;
  NewMenuLink.PopupMenu := dxBarPopupMenu;
end;
cpp
// ...
TdxBarPopupMenuLink * NewMenuLink;
NewMenuLink = dxBarManager->PopupMenuLinks->Add();
NewMenuLink->Control = Edit1;
NewMenuLink->PopupMenu = dxBarPopupMenu;