The Code Cave

August 2, 2006

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

Filed under: Delphi — Brian @ 12:00 am

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:
  1. Memo1.SelStart:=Length(Memo1.Text);
  2. Memo1.SelLength:=0;
  3. SendMessage(Memo1.Handle, EM_SCROLLCARET, 0, 0);

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

1 Comment »

  1. The code on getting to the end or in my case the beginning of a TMemo was helpful. I was manually populating a TMemo and having trouble finding how to get to the beginning for the user to view properly.
    Thanks,

    Comment by Bob — March 13, 2008 @ 9:32 am

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress