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 delete all selected items in a multiselect TSectionListBox

This procedure will delete all selected items from a TSectionListBox :
procedure TForm1.Button1Click(Sender: TObject);
var
  i: Integer;
  sectionidx,subitemidx: Integer;
begin
  i := 0;

  with sectionlistbox1 do
    while (i < Items.Count) do
    begin
      if Selected[i] then
      begin
        Selected[i] := False;

        GetListItemIndex(i,sectionidx,subitemidx);

        Sections.Items[sectionidx].subitems.Delete(subitemidx);

      end
      else
        inc(i);

 end
end;