Solved

Get cursor Y position in Rich Edit

Posted on 1998-10-18
3
469 Views
Last Modified: 2006-11-17
How do i get the line where the cursor is in a Rich Edit Control. Not the cursor caracter position with Selstart but
The LINE position.
Anyone knows?

THX.
Avataris
0
Comment
Question by:genanja
  • 2
3 Comments
 
LVL 5

Accepted Solution

by:
JimBob091197 earned 200 total points
ID: 1343287
Hi

You use the EM_LINEFROMCHAR message.  For example, if you have a TRichEdit called rchTest, you could do the following:
  LineNum := rchTest.Perform(EM_LINEFROMCHAR, -1, 0);
(0 = 1st line, 1 = 2nd line, etc.)

For any character position, the following will return the line number:
  LineNum := rchTest.Perform(EM_LINEFROMCHAR, CharIndex, 0);

Similarly, the following will return the character index (like SelStart) for the 1st character on a line:
  CharIx := rchTest.Perform(EM_LINEINDEX, LineNum, 0);

Cheers,
JB
0
 

Author Comment

by:genanja
ID: 1343288
Jim you are wonderfull. It's working perfectly
Thank you very very much.....

Avataris

0
 
LVL 5

Expert Comment

by:JimBob091197
ID: 1343289
;-)  Glad to help.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi XE2 application frozen on Windows 10 10 312
Delphi XE10, MySQL Query 4 143
error 1.1 400 Bad request idhttp delphi 18 90
control image tags in a string ? 12 131
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…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

810 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