Good afternoon,
i'm using tadvricheditor as "logger" to trace how happend in a procedure.
In this procedure, called every 2 minutes, there is a query that has hundred (if not thousand) of rows and each row is added to richeditor and the performance is loose (something like this post https://support.tmssoftware.com/t/tadvricheditor-performance/6679).
This is (in short how) the procedure that is runs every 2 minutes
AddLogLine(RM1, 'Chek for order(s)', ClGreen);
S:='Select Ordini.*, DettaglioOrdini.* From Ordini ';
S:=S + 'Inner Join DettaglioOrdini On DettaglioOrdini.Numero=Ordini.Numero ';
S:=S + 'Where Ordini.Data = ' + QuotedStr(Today) and DettaglioOrdini.DOQTA>0;
FQr.Active:=False;
FQr.Sql.Clear;
FQr.Sql.Add(S);
FQr.Active:=True;
If Fqr.RecordCount>0 Then
Begin
AddLogLine(RM1, 'Found ' + IntToStr(Fqr.RecordCount) + ' Order(s)', ClYellow);
FQr.First;
While Not Fqr.Eof Do
Begin
// some work and at the end i show some data as:
AddLogLine(RM1, 'Order Number: ' +
FQr.FieldByName(ON).AsString' + #32 +
'Item: ' + FQr.FieldByName(DODES).AsString + #32 +
'QTA: ' + FQr.FieldByName(DOQTA).AsString , ClMagenta);
FQr.Next
End;
End
Else
Begin
AddLogLine(RM1, 'Order(s) not found', ClRed);
end;
procedure AddLogLine(RM : TAdvRichEditor; Text : string; Color : TColor = ClBlack);
begin
RM.SetCaret(cpBeginDoc);
RM.AddLineBreak;
RM.SetCaret(cpBeginDoc);
RM.InsertText(NowToStr + #32 + Text);
RM.SelectText(0,Length(NowToStr + #32 + Text));
RM.SetSelectionColor(Color);
RM.InsertLineBreak;
RM.UnSelect;
RM.Update;
end;
After 20 minuted (10 times the procedure runned) and hundred/thousand lines added ... the RichEditor is very very slow, and after more time is almost stopped.
The problem is that i have the need to show line by line what i found and i can understand that RM.Update called each time could be the problem.
Have you any suggestion ? (for example is possible happend some plain text to an existing text file?)
Thank you for your attention
Best regards
Daniele