TMSFMXRichEditor - appending HTML formatted text

A FMXRichEditor is loaded with HTML formatted content. Next I want to append another piece of text formatted as HTML.


Approach:


      LoadHTML( reExplanation, TPage_Question(Page).Explanation );
      AppendHTML( reExplanation, TPage_Question(Page).Text );


Where:

procedure TFrameDisplay_Custom.LoadHTML(aRichEditor: TTMSFMXRichEditor; aSource: string);
begin
  HTMLIO.RichEditor := aRichEditor;
  HTMLIO.LoadFromString( aSource );
end;


procedure TFrameDisplay_Custom.AppendHTML(aRichEditor: TTMSFMXRichEditor; aSource: string; aStartNewLine: boolean = TRUE);
begin
  if aStartNewLine then
    begin
      aRichEditor.AddLineBreak;
      aRichEditor.AddText('Hans');  // for testing purposes only
      aRichEditor.AddLineBreak;
      aRichEditor.SetCaret( maxint );
    end;
  HTMLIO.RichEditor := aRichEditor;
  HTMLIO.Insert( aSource );
end;


What happens is that the HTMLIO.Insert() appends the aSource text directly after the last character of the already available text. I would expect aSource to be inserted after the last linebreak, but that does not happen.

Any ideas?

The SetCaret() call seems wrong.


Please use the code: