Board index » delphi » ListView flashes whenever I change an item's imageindex

ListView flashes whenever I change an item's imageindex

when I change a listitem's imageindex listview draws all the items and if
listview has a large area this makes an annoying flash effect. how can I
prevent listview from redrawing all items?
 

Re:ListView flashes whenever I change an item's imageindex


Quote
"Serdar" <serda...@yahoo.com> wrote:
>when I change a listitem's imageindex listview draws all the items and if
>listview has a large area this makes an annoying flash effect. how can I
>prevent listview from redrawing all items?

Have you tried:

ListView1.Items.BeginUpdate;
try
  {do your stuff}
finally
  ListView1.Items.EndUpdate;
end;

Rick Carter
Rick.Car...@cincww.rcc.org
Chair, Paradox/Delphi SIG, Cincinnati PC Users Group

Re:ListView flashes whenever I change an item's imageindex


yes but this is not the solution for that I do the stuff just for one item
in a second. and every second the listview flickers..
I found the solution few hours ago. I make the brush.style bsclear and then
{do the stuff} and then listview.update and I restore the brushstyle. this
solved my problem a bit. although the flicker is gone but all the lisview is
repainted (icons and texts) and this takes a lot of cpu.
Quote
> Have you tried:

> ListView1.Items.BeginUpdate;
> try
>   {do your stuff}
> finally
>   ListView1.Items.EndUpdate;
> end;

Re:ListView flashes whenever I change an item's imageindex


You could also hook an OnGetImageIndex event handler instead of
setting TListItem.ImageIndex. When you know that the event handlerwill
return a different index for a number of items you can just invalidate
the whole listview to reflct the change.

Quote
"Serdar" <serda...@yahoo.com> wrote in message

news:3d2b5f4c_1@dnews...
Quote
> yes but this is not the solution for that I do the stuff just for
one item
> in a second. and every second the listview flickers..
> I found the solution few hours ago. I make the brush.style bsclear
and then
> {do the stuff} and then listview.update and I restore the
brushstyle. this
> solved my problem a bit. although the flicker is gone but all the
lisview is
> repainted (icons and texts) and this takes a lot of cpu.

Other Threads