Search code examples
delphiscrolltmemo

TMemo Scrolling in Delphi


I am adding lines of text to a TMemo using : Memo1.Lines.Add(Text), which causes Memo1 to scroll to the bottom.

Is there any way to either stop it scrolling as I add lines, or force it to go back to the top when I finished?

I want a simple solution...

Thanks...


Solution

  • You can use begin/end update for lines collection:

    memo.Lines.BeginUpdate;
    try
      memo.Lines.Add('test');
    finally
      memo.Lines.EndUpdate;
    end;