How to scroll to the end of a TMemo or TRichEdit in Delphi

This is a simple one, but I had to look it up.

So, by my self imposed rules, I have to post it.

This text will constantly scroll memo-like-fields to the end.

[delphi]
Memo1.SelStart:=Length(Memo1.Text);
Memo1.SelLength:=0;
SendMessage(Memo1.Handle, EM_SCROLLCARET, 0, 0);

[/delphi]

This allows you to have an active logging component at the bottom of a form. Proof of concept coming soon.

3 Comments

Add a Comment

Your email address will not be published. Required fields are marked *