1. Home
  2. Computing & Technology
  3. Delphi Programming

Get the line number from a RichEdit

By , About.com Guide

Yes, this function is missing from TRichEdit. You can get the line number from cursor by using a windows message (on a RichEdit named REdit):

REdit.Perform(EM_LINEFROMCHAR,REdit.SelStart,0) ;

this will return the line number. There is also a windows message (EM_CHARFROMPOS) that will return the character position from the screen cursor coordinates. Look in the windows help file for more info. Beware that these functions are pretty slow, and should not be used inside of loop that get called a lot.

Delphi tips navigator:
» Enable/Disable Desktop icons
« TColor to HTML color

Explore Delphi Programming
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Delphi Programming
  4. Coding Delphi Applications
  5. Delphi Tips and Tricks
  6. 2000 Delphi Tips
  7. Get the line number from a RichEdit

©2009 About.com, a part of The New York Times Company.

All rights reserved.