Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Scrolling to the end of a TMemo

727 views
Skip to first unread message

Josh Griffith

unread,
Jun 22, 2003, 10:09:14 PM6/22/03
to
I'm using a TMemo to represent logged events in an application. However,
when I add a line to the memo, it's added at the end, out of view. How can
I have the memo always scroll so that the last line visible is selected?
Is there a component that does this inherently?

--
Joshua Griffith

Ko, Young

unread,
Jun 22, 2003, 11:11:42 PM6/22/03
to
uses Message <WM_VSCROLL>

try
Memo1.Lines.Add('test - hahaha');
SendMessage(Memo1.Handle, WM_VSCROLL, SB_LINEDOWN, 0);
except

end;

"Josh Griffith" <jo...@e-josh.com> wrote in message
news:oprq66xo...@newsgroups.borland.com...

Paolo Canzian

unread,
Jun 23, 2003, 4:20:06 AM6/23/03
to
I did something like this but I am not able to recall the code.
If I remember well it was something like:

Memo1.Lines.Add('MyText');
Memo1.SelStart := Length(Memo1.Text);

I tested briefly, it works but it leaves a blank line at the and.
Sorry but I have no time to try to fix it.

Regards
Paolo

"Josh Griffith" <jo...@e-josh.com> wrote in message
news:oprq66xo...@newsgroups.borland.com...

Josh Griffith

unread,
Jun 23, 2003, 10:16:55 AM6/23/03
to
On Sun, 22 Jun 2003 22:09:14 -0400, Josh Griffith <jo...@e-josh.com> wrote:

> How can I have the memo always scroll so that the last line visible is
> selected?

Thanks for the responses. I manages to fix the problem by writing to the
memo in the OnActivate event handler and it scrolls fine. I think my
problem was that the control didn't have focus when I was trying to send it
scroll messages.

--
Joshua Griffith

Andrew Ofthesong

unread,
Jun 24, 2003, 8:13:06 PM6/24/03
to
Mm, none of them worked for me....

They scroll down, but not completelly...

"Josh Griffith" <jo...@e-josh.com> escribió en el mensaje
news:oprq74mh...@newsgroups.borland.com...

Andrew Ofthesong

unread,
Jun 24, 2003, 8:15:46 PM6/24/03
to
but this did work:


SendMessage(MemoOut.Handle, WM_VSCROLL, SB_BOTTOM, 0);

"Andrew Ofthesong" <And...@NoSpam.net> escribió en el mensaje
news:3ef8...@newsgroups.borland.com...

0 new messages