En/na Marc Weustink ha escrit:

For scrolling after a line is added, I don't know. Personally I hate it when a memo gets updated and I want to read the contents the same time.

Well, there could be a property that controls this behavior.
Or scroll to the bottom only if the last line is visible (assuming that if it isn't visible you've manually scrolled to read old messages). That's what, e.g., kconsole does, and I manually replicated it with a TSynMemo (I'm not sure it'll work with a plain TMemo), something like:

function TMyForm.AtBottom:boolean;
begin
  Result:=SMemo.TopLine>Smemo.Lines.Count-Smemo.LinesInWindow;
end;

procedure TMyForm.ScrollToBottom;
begin
  SMemo.TopLine:=SMemo.Lines.Count-SMemo.LinesInWindow+1;
end;

procedure TMyForm.test;
var autolast:boolean;
    i:integer;
begin
   autolast:=AtBottom;
   SMemo.lines.beginupdate;
   for i:=1 to 10 do SMemo.lines.append(IntToStr(i));
   SMemo.lines.endupdate;
   if autolast then ScrollToBottom;
end;


Bye
--
Luca Olivetti
Wetron Automatización S.A. http://www.wetron.es/
Tel. +34 93 5883004      Fax +34 93 5883007

_________________________________________________________________
    To unsubscribe: mail [EMAIL PROTECTED] with
               "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to