Skip to main content

TdxBarItem.Category, TdxBarManager.ItemCount, TdxBarManager.Items Example

The following code snippet represents the TdxBarEdit.OnChange event handler that creates a new category, and moves all TdxBarLargeButton buttons to this category. The category’s name is specified by the Text property of the TdxBarEdit control.

procedure TForm1.dxBarEdit1Change(Sender: TObject);
var
  i: Integer;
begin
  with dxBarEdit1.BarManager do
  begin
    BeginUpdate;
    Categories.Add(dxBarEdit1.Text);
    for i := 0 to ItemCount - 1 do
      if Items[i] is TdxBarLargeButton then
      begin
        Items[i].Category := Categories.Count - 1;
        Items[i].Caption := 'NewCaption' + IntToStr(i);
      end;
    EndUpdate;
  end;
end;