Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to autoscroll to the end of RichEdit?

I never needed to use the TRichEdit before, always used TMemo.

I'd like RichEdit autoscrolling to the end when I add text like TMemo. See how it looks after you add some data:

enter image description here

As you can see, the scroll bar remains at the top, but I'd like it stayed at the bottom as I added text.

I've 'googled' for solutions but I couldn't find a good and reliable one.

like image 507
Daniel Grillo Avatar asked Jun 16 '11 12:06

Daniel Grillo


1 Answers

Try this code

RichEdit1.SetFocus;
RichEdit1.SelStart := RichEdit1.GetTextLen;
RichEdit1.Perform(EM_SCROLLCARET, 0, 0);
like image 88
Bharat Avatar answered Oct 10 '22 05:10

Bharat