Retrieving selected items in a TListView with MultiSelect on.

An example of how to retrieve a list of selected nodes within a TListView.

var

  i: Integer;

  s: string;

  ls: TListItem;

begin

  ls := ListView1.Selected;

  // if there at least one item

  if Assigned(ls) then

  begin

    ls := ListView1.GetNextItem(ls, sdAll, [isSelected]);

    // if there are more than one

    while Assigned(ls) do

    begin

      // do your stuff

      ls := ListView1.GetNextItem(ls, sdAll, [isSelected]);

    end;

  end;

end;

 

Share this article!

Follow us!

Find more helpful articles: