Mega Code Archive

 
Categories / Delphi / Examples
 

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;