Mirror

How to make a TMemo show the chosen line (Views: 709)


Problem/Question/Abstract:

How can I have a memo show a chosen line? In fact my program does some work and puts information in a memo, I would like the last line of the memo to be always visible. I tried MyMemo.ScrollBy(0, MaxInt), but that does not work.

Answer:

with Memo1 do
begin
  SelLength := 0;
  SelStart := Perform(EM_LINEINDEX, LineNo, 0);
  Perform(EM_SCROLLCARET, 0, 0);
end;

LineNo hold the line number you want to scroll to.

<< Back to main page