Reputation: 367
How can i see if exactly one item is selected in a listview?
I now use:
if listview1.Selected <> nil then
begin
...
end;
But this code works when one or more items are selected, what is the script to see if one item is selected
Upvotes: 1
Views: 2647
Reputation: 3043
You did not provide any info on Delphi version, VCL or FireMonkey... so I'm not sure this will work in all cases:
If ListView1.Selected = ListView1.Items[IndexOfItemYouWantToCheck]
or, if you have a reference to the item in some variable, then:
If ListView1.Selected = ItemYouWantToCheck
Upvotes: 0