I have this procedure:
procedure TForm1.RichMemoApplic();
Var
tmpNode:PVirtualNode;
Data: PTreeData;
aFont:TFontParams;
versione:TVersions;
tempo:TDateTime;
aN:integer=0;
begin
//exit; //Troppo lenta
tempo:=Now;
tmpNode:=VST.GetFirst();
while tmpNode<>nil do
begin
inc(aN);
if MilliSecondsBetween(Now,tempo)>2000 then
begin
form1.Caption:=inttostr(aN);
application.ProcessMessages;
tempo:=Now;
end;
Data := VST.GetNodeData(tmpNode);
if (Data^.num>=0) and (Data^.num<length(versioni)) then
begin
if Data^.memoPos>-1 then
begin
versione:=versioni[Data^.num];
if compatibileApplic(selApplic,versione) then
begin
// richmemo1.GetTextAttributes(Data^.memoPos+Data^.memoTabs,aFont);
aFont.Style:=[];
// richmemo1.SetTextAttributes(Data^.memoPos+Data^.memoTabs,Data^.memoLen,aFont);
end
else
begin
// richmemo1.GetTextAttributes(Data^.memoPos+Data^.memoTabs,aFont);
aFont.Style:=[fsStrikeOut];
// richmemo1.SetTextAttributes(Data^.memoPos+Data^.memoTabs,Data^.memoLen,aFont);
end;
end;
end;
tmpNode:=VST.GetNext(tmpNode);
end;
end;
Commenting the richmemo1.SetTextAttributes and GetTextAttributes the procedure completes in less than one second. If I uncomment those lines the procedure completes in several minutes. The problem is that there are more than 37000 lines in richmemo and every single time it updates the GUI.
I think that if I could update the entire TRichmemo just at the end of the procedure it would be much faster.
Any idea ?
Thank you