vcl-155070-expressbars-how-to-associate-a-tdxbarpopupmenu-with-controls.md
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:
Select a bar manager in the Object Inspector.
Press the ellipsis button (‘…’) in the PopupMenuLinks edit field to display a standard collection editor with a list all existing menu links.
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:
// ...
var
NewMenuLink : TdxBarPopupMenuLink;
begin
NewMenuLink := dxBarManager1.PopupMenuLinks.Add;
NewMenuLink.Control := Edit1;
NewMenuLink.PopupMenu := dxBarPopupMenu;
end;
// ...
TdxBarPopupMenuLink * NewMenuLink;
NewMenuLink = dxBarManager->PopupMenuLinks->Add();
NewMenuLink->Control = Edit1;
NewMenuLink->PopupMenu = dxBarPopupMenu;