• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 288
  • 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);

0
abarilla
Asked:
abarilla
1 Solution
 
ms99Commented:
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:

var
  c:tcaretPos;

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.

0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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