Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


TMemo cursor issue

Posted on 2004-10-28
Medium Priority
Last Modified: 2010-04-05
My memo shows line 0 to 9 and its count is 30 (-> scrollbars show up). I set my cursor to line 15 via SelStart. How can I make my memo show the cursor, i.e. scroll to line 15.
Question by:__alex
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2

Author Comment

ID: 12432925
Actual workaround:

SelLength := 1;
SelLength := 0;
LVL 27

Accepted Solution

kretzschmar earned 500 total points
ID: 12433006
take a look to the em_scrollcaret api

should be like


maybe you must include the unit richedit into the uses-clause (not sure)

just from head

meikl ;-)
LVL 17

Assisted Solution

geobul earned 500 total points
ID: 12433070
Another way:

procedure MemoSetCursor(Memo: TMemo; CharIndex: integer);
  Memo.SelStart := CharIndex;
  Memo.SelLength := 0;

Regards, Geo

Author Comment

ID: 12433274
A simple call to SelLength does it? Weird...
LVL 27

Expert Comment

ID: 12433336
>A simple call to SelLength does it? Weird...
not really weird

internal is called then th em_setsel message

part from the docu about em_setsel
In previous versions of Windows, the wParam parameter is a flag that is set to FALSE to scroll the caret into view or set to TRUE to omit the scrolling. A Win32-based application should use the EM_SCROLLCARET message to scroll the caret into view.

guess it works because of this

meikl ;-)

Featured Post

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

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…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

618 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