Skip to main content
A newer version of this page is available.

Example: TreeList.CreateColumn, Column.ApplyBestFit

The following sample shows how to create columns. The CreateColumns method accepts the following parameters:

AColumns contains captions for new columns. Note that this parameter should be initialized.

ABand represents the band to which the new columns will belong.

procedure CreateColumns(AColumns: TStringList; ABand: TcxTreeListBand);
var
  I: Integer;
begin
  for I := 0 to AColumns.Count - 1 do
    with cxTreeList.CreateColumn(ABand) do
      begin
        Caption.Text := AColumns[I];
        ApplyBestFit;
      end;
end;