Skip to main content

TdxBarContainerItem, TdxBarItemLink.BeginGroup Example

This example demonstrates using a TdxBarContainerItem in a MDI application. The AddMenu procedure displayed below creates submenus on the parent toolbar with the child form’s main toolbar items. The items are added to the parent toolbar’s container item.

procedure AddMenu;
var
  ABarManager: TdxBarManager;
begin
  ABarManager := GetBarManagerByForm(ChildForm1);
  ABarManager.BeginUpdate;
  with dxBarContainerItem1 do
  begin
    ItemLinks := ABarManager.MainMenuBar.ItemLinks;
    Caption := ChildForm1.Caption;
  end;
  ABarManager.EndUpdate;
end;

The following code hides the created submenus.

dxBarContainerItem1.Visible := ivNever;

The following code demonstrates how an existing TdxBarButton can be added to the container item as the first item in a group.

with dxBarContainerItem1 do
  begin
    // adding the item link
    ItemLinks.Add.Assign(dxBarButton1.Links[0]);
    // making the item control first in the group
    ItemLinks.Items[ItemLinks.Count-1].BeginGroup := True;
  end;