[Lazarus] TMemo flicker

Michael Van Canneyt michael at freepascal.org
Tue Apr 30 10:31:04 CEST 2013



On Tue, 30 Apr 2013, shoKwave wrote:

> 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.

In that case the beginupdate/endupdate is a total waste of CPU.

Michael.


More information about the Lazarus mailing list