Solved

Scrolling a CLX TMemo

Posted on 2002-04-12
1
280 Views
Last Modified: 2010-04-04
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
Comment
Question by:abarilla
1 Comment
 

Accepted Solution

by:
ms99 earned 50 total points
ID: 6956473
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Machine not responding during CopyFile() 3 104
Downloading email attachments 2 79
How to create virtual printer while installing my application 5 61
RESTRequest Parameter 4 42
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question