• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 292
  • Last Modified:

Scrolling a CLX TMemo

I need to scroll a TMemo to the current caret position.  I know how to do this in Windows but how would I do it in Kylix?

Windows code:
SendMessage(LogMemo.Handle, EM_SCROLLCARET, 0, 0);

1 Solution
Hi, abarilla:

In Kylix (and also Delphi6 using clx) TMemo has a new property: CaretPos.

In order to move the caret you set this property:


c.line := 1;  
c.col := 1;
memo1.caretPos := c;

c.line := memo1.lines.count-1;  
c.col := 1;
memo1.caretPos := c;

When you set memo1.caretPos, the control automatically scrolls to make the caret visible.

I think:
c := memo1.caretPos;
memo1.caretPos := c;

will scroll memo1 to make the caret visible.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now