[Lazarus] TMemo flicker

shoKwave shokwave at gmx.net
Tue Apr 30 10:29:13 CEST 2013


Am 30.04.2013 10:06, schrieb Michael Van Canneyt:
>
> It should be
>   memo1.Lines.BeginUpdate;
>   for i := 1 to 1000 do
>     Memo1.Lines.Add('#### LAST LINE 
> ---'+IntToStr(i)+'-----------------------------------------------------------');
>   memo1.Lines.EndUpdate;
>   Application.Processmessages;
>
> What you did makes no sense whatsoever. The whole point of 
> beginupdate/endupdate is to mark a list of changes, and to prevent the 
> UI from updating while you do the changes.
>
> The use of Add() is easier to understand.
>
> Michael.
But this way you wouldn't see the progress.

Including only
Memo1.Lines[Memo1.Lines.Count-1] := '#### LAST LINE 
---'+IntToStr(i)+'-----------------------------------------------------------';
will also include all calculations of TMemo so you prevent flickering 
and see the progress. This makes sense to me.

Your solution of course is mutch faster but I thought seeing the 
progress is important for Jürgen.

Ingo






More information about the Lazarus mailing list