Delphi XE2 listview artifacts
Asked Answered
D

1

8

I am using listview in vsreport virtual mode, have two columns and after I populate the list, select one row, and then select some other row there's an artifact left on a previously selected row, see image below. How to fix this?enter image description here

and this is my code that gets the data from an array

procedure TForm1.ListView1Data(Sender: TObject; Item: TListItem);
begin
  Item.Caption := FloatToStr(Item.Index + 1);
  Item.SubItems.Add(FloatToStr(a[Item.Index]));
end;

When I hover the mouse, the artifacts dissapear. Thanks

Diarrhoea answered 18/3, 2013 at 21:18 Comment(7)
Please provide screenshot and code (if it is needed to reproduce)Redfield
OK, I can reproduce now. It will only do it for virtual mode.Redfield
Apparently setting the listview's doublebuffered property to true solves the problem. Not sure what to do with this question now.Diarrhoea
I don't like that solution. I have a very similar list view that does not behave that way. Please leave the question open. The other person who will likely help is Sertac who is a wizard with comctl32 controls.Redfield
OK, I'm getting somewhere. If I make the form derive from my own base form class, the artifacts disappear. I just need to work out what is special about my form.Redfield
Ha! Turns out that my code sets DoubleBuffered for list views because that's the only way I've found to stop resize flicker. So I've got nothing more than you managed to work out all by yourself.Redfield
If I were you I would add that as an answer. I'll vote for it. This is a very useful observation. Would be nice to keep it around.Redfield
D
8

Setting the listview's DoubleBuffered property to true solves the artifacts problem.

Diarrhoea answered 18/3, 2013 at 22:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.