Skip to main content

TdxBarListItem.Items Example

The following code snippet demonstrates how to populate the Items collection of a TdxBarListItem.

The AddRecentFiles procedure displayed below adds a file specified by the AFileName parameter to the list of recently used files in a TdxBarListItem. The AMaxNumberOfFiles parameter specifies the maximum number of file names to store.

procedure AddRecentFiles(AFileName: string; AMaxNumberOfFiles: Integer);
var
  i: Integer;
begin
  with dxBarListItem1 do
  begin
    BarManager.BeginUpdate;
    if Items.Count < AMaxNumberOfFiles then
      Items.Add('');
    for i := Items.Count - 1 downto 1 do
      Items[i] := Items[i-1];
    Items[0] := AFileName;
    BarManager.EndUpdate;
  end;
end;