Skip to main content

Example: TreeList.VisibleColumnCount, TreeList.VisibleColumns

The following sample code fills a string list with captions of the visible columns within the control. The GetVisibleColumnsList method uses the VisibleColumns and VisibleColumnCount properties to get access to the collection and to determine the number of visible columns within the collection.

Note that the AColumns parameter should be already initialized.

procedure GetVisibleColumnsList(AColumns: TStringList);
var
  I: Integer;
begin
  for I := 0 to cxTreeList.VisibleColumnCount - 1 do
    AColumns.AddObject(cxTreeList.VisibleColumns[I].Caption.Text, cxTreeList.VisibleColumns[I]);
end;