Board index » delphi » Listivew constantly refreshing?

Listivew constantly refreshing?

I was setting up a virtual listview for the by populating the OnData event
but with or without on the OnCustomDraw event I find the list constantly
redrawing itself (flickering) is there a trick to getting this working as I
pretty much copied the virtual listview demo and it doesn't flicker?
Anything to look out for?

:Dave

 

Re:Listivew constantly refreshing?


There must be:
a. A bug in your program (fix your program)
or
b. You are constantly changing the contents of the listview (set
ListView.DoubleBuffered to true)

"David Szkilnyk" <dszkil...@iprimus.com.au> schreef in bericht
news:39068838@news.iprimus.com.au...

Quote
> I was setting up a virtual listview for the by populating the OnData event
> but with or without on the OnCustomDraw event I find the list constantly
> redrawing itself (flickering) is there a trick to getting this working as
I
> pretty much copied the virtual listview demo and it doesn't flicker?
> Anything to look out for?

> :Dave

Re:Listivew constantly refreshing?


you should set the items.count property to the number of items. in the
OnDraw handler you should NOT set the items.count again.

cheers,
eric

M.H. Avegaart <avega...@NOSPAMmccomm.nl> schreef in berichtnieuws
8e692i$ni...@porthos.nl.uu.net...

Quote
> There must be:
> a. A bug in your program (fix your program)
> or
> b. You are constantly changing the contents of the listview (set
> ListView.DoubleBuffered to true)

> "David Szkilnyk" <dszkil...@iprimus.com.au> schreef in bericht
> news:39068838@news.iprimus.com.au...
> > I was setting up a virtual listview for the by populating the OnData
event
> > but with or without on the OnCustomDraw event I find the list constantly
> > redrawing itself (flickering) is there a trick to getting this working
as
> I
> > pretty much copied the virtual listview demo and it doesn't flicker?
> > Anything to look out for?

> > :Dave

Re:Listivew constantly refreshing?


In article <39068...@news.iprimus.com.au>, "David Szkilnyk"

Quote
<dszkil...@iprimus.com.au> writes:
>I was setting up a virtual listview for the by populating the OnData event
>but with or without on the OnCustomDraw event I find the list constantly
>redrawing itself (flickering) is there a trick to getting this working as I
>pretty much copied the virtual listview demo and it doesn't flicker?
>Anything to look out for?

Sounds as though you are causing that event handler to be called again by the
code in that event handler.

Prevent it by storing the value of the event handler as your first line of
code, and then set it to nil. Do your other code and as the last line of the
event handler, re-set it to the original value. For example, in an OnChange
event of a TEdit :-

procedure TForm1.Edit1Change(Sender: TObject);
var
  OldOnChange : TNotifyEvent; // type of the TEdit.OnChange
begin
  OldEditOnChange := Edit1.OnChange;
  Edit1.OnChange := nil;
  // code which changes the edit text, and would cause OnChange to be called
  Edit1.OnChange := OldOnChange;
end;

Alan Lloyd
alangll...@aol.com

Other Threads