Solved

Get cursor Y position in Rich Edit

Posted on 1998-10-18
3
480 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
[X]
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
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

726 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