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.
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,
This is very helpful to proceed a line by line scrolling…
But do you know how to proceed a scrolling pixel by pixel ???
the same way as if we use manually the vertical scroll ??
i tryed to find to do that with a TMemo in FMX.. but i can’t find a way.
Any ideas ?
thanks, Best regard.
I don’t know that you can do it by pixels, but there is a WM_VSCROLL message that scrolls the box to a position within a vscroll range. You’ll have to look up how to use it along with setscrollrange, but that would allow you to scroll the box at a max resolution of 1/65,535 at a time which might be smaller than one pixel.
It’s been 7 years since I played in Delphi. So you’ll have to look this all up. 🙂