TMemo cursor/caret/scroll position lazarus / 31-LCL ---------------------------------------------------------------------- MarkMLl · 2020-05-12 13:28 I know that issues related to the scrolling etc. behaviour of a TMemo are an FAQ, usually related to using it for log/debug output. Answers tend to use some variant of Code: [Select]  Memo1.selstart:=pos(memo1.lines[newline],memo1.text)-1;   Memo1.SelLength:=0;   Memo1.Perform(EM_SCROLLCARET, 0, 0);   Memo1.SetFocus; I believe that EM_SCROLLCARET and possibly the Perform() method are Windows-specific. Is there a portable or at least Linux-compatible equivalent? MarkMLl ---------------------------------------------------------------------- lucamar · 2020-05-12 13:58 I have never needed to call Perform(EM_SCROLLCARET, 0, 0); just setting SelStart/SelLentgh usually scrolls to the new caret position. But if you really need to scroll to a certain position you can try using Memo.ScrollBy: store the current position (CaretPos), set the new SelStart/SelLength, get the new position, calculate the X and Y deltas and call ScrollBy() HTH ---------------------------------------------------------------------- MarkMLl · 2020-05-12 14:06 TFT. Broadly speaking SelStart seems to do the trick... there's a bit of drift but I was just wondering whether I was missing anything important. (Later) The reliable way, at least on GTK2, appears to be to adjust CaretPos.Y as stuff is being appended to the end of the TMemo and possibly deleted from the beginning. The preserved position does appear to get pushed down to the bottom of the visible portion of the control, but that's cosmetic from my POV. MarkMLl