Frequently Asked Component Specific Questions

Options

Display all FAQ items

Search FAQ items:


Displaying items 1 to 1 of 1, page 1 of 1

<< previous next >>

TColumnListBox
Adding columns and items programmatically at runtime

This code snippet creates a TColumnListBox with 2 columns and 2 items at runtime:
var
  cb: TColumnListbox;
begin
  cb := TColumnListbox.Create(self);
  cb.Parent := self;
  cb.Columns.Add;
  cb.Columns.Add;

  with cb.ListBoxItems.Add do
  begin
    Strings.Add('Col 1 Row 1');
    Strings.Add('Col 2 Row 1');
  end;

  with cb.ListBoxItems.Add do
  begin
    Strings.Add('Col 1 Row 2');
    Strings.Add('Col 2 Row 2');
  end;
end;