[Lazarus] TMemo flicker
José Mejuto
joshyfun at gmail.com
Tue Apr 30 11:01:03 CEST 2013
El 30/04/2013 10:31, Michael Van Canneyt escribió:
>> 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.
>
Hello,
The problem is that the behavior changes with the use of begin/end
update, at least on Windows platform. Run attached code to test. Just
create a form and add a button and a Memo and link the button OnClick
with this code (better visible with a quite big Memo):
-------------------------------
procedure TForm1.Button1Click(Sender: TObject);
const
TestMode=3; //CHANGE to 1..3 to run different tests
var
i: integer;
begin
for i := 1 to 40 do begin
Memo1.Lines.add('Some lines at the beginning to watch the up/down
flicker effect.');
end;
if TestMode=1 then begin
for i := 1 to 1000 do begin
Memo1.Lines[Memo1.lines.Count-1]:='#### '+IntToStr(i);
end;
end else if TestMode=2 then begin
for i := 1 to 1000 do begin
Memo1.Lines.BeginUpdate;
Memo1.Lines[Memo1.lines.Count-1]:='#### '+IntToStr(i);
Memo1.Lines.EndUpdate;
end;
end else if TestMode=3 then begin
for i := 1 to 1000 do begin
Memo1.Lines.BeginUpdate;
Memo1.Lines[Memo1.lines.Count-1]:='#### '+IntToStr(i);
Memo1.Lines.EndUpdate;
Application.ProcessMessages;
end;
end;
end;
--------------------------------
If Begin/End update is being used the vertical scroll bar position is
not updated, I do not know if this is expected :-?
--
More information about the Lazarus
mailing list