Good morning to all,
in my project i'm inserting a TAdvRichEditor as a log and the lines have it's own color according to the procedure are called.
I have some problems, one is how insert one line as first line.
To this problem i got this answer
[AdvRichEditor insert text line to custom postion with custom color]
but when i try to it with this (as exampple)
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.UnSelect;
(*
// Default insert line at bottom
RM.AddText(NowToStr + #32 + Text, Color);
RM.AddLineBreak;
RM.ScrollToCaret; // The document does not scroll to last line
*)
RM.Invalidate;
end;
i got this result
but the result could be (i have adjust it manually)
Anothe problem is if i add the text at the end of the document (as default) and the lines go out of the bottom control view, even i call RM.ScrollToCaret the visible text is not updated.
Can you give me some help ?
Thank you
Best Regards
Daniele