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 >>

TSectionListBox
How to retrieve the selected items in a multiselect TSectionListBox

This example code copies all selected items from a TSectionListBox to a TListBox :
procedure TForm1.Button1Click(Sender: TObject);
var
  i,j,k:integer;
begin
  for i := 1 to sectionlistbox1.Sections.Count do
    if sectionlistbox1.sections.items[i-1].State = lssExpanded then
      for j := 1 to sectionlistbox1.sections.items[i-1].SubItems.Count do
      begin
        k := SectionListBox1.GetSectionListIndex (i-1)+j-1;

      if sectionlistbox1.selected[k+1] then

        listbox1.Items.Add(sectionlistbox1.sections.items[i-1].SubItems[j-1]);

    end;
end;