Thank you for replies everyone. I think I found a solution, but I don't know how to implement it. See, what makes my problem possibly a lot simpler is that the RichMemo contents is read-only, it's contents do not change, except for the one string that I am trying to insert into the RichMemo - and the position this string is to be inserted at remains constant too.
I found the InsertStyledText procedure on the RichMemo wiki page:
procedure InsertStyledText(
const ARichMemo: TCustomRichMemo;
const TextUTF8: String;
AStyle: TFontStyles;
InsPos : Integer = -1 )
How do I implement this procedure? I tried this:
procedure InsertStyledText(
const ARichMemo: TCustomRichMemo;
const TextUTF8: String;
AStyle: TFontStyles;
InsPos : Integer = -1 );
begin
end;
procedure TForm1.Button1(Sender: TObject);
begin
InsertStyledText(RichMemo1, 'hello', [fsBold], 32);
end;
This doesn't do anything though. But I want 'hello' the be inserted at position 32.
I know how to work with functions, but I have no idea what to do with this procedure - it's not part of RichMemo.
Thanks.