Solved

Get the current line number in a RichEdit

Posted on 1998-03-31
4
315 Views
Last Modified: 2013-11-22
Does anyone know how to get the line number that the currsor is on in a TRichEdit.  In a TMemo you can do a
iLine := Memo1.Perform(em_LineFromChar, $FFFF, 0);
but the RichEdit will always return the total number of lines instead of the current line.  
Thanks
0
Comment
Question by:Greedy
  • 2
  • 2
4 Comments
 
LVL 4

Accepted Solution

by:
itamar earned 50 total points
ID: 1361133
Hi Greedy,

Try:

     iLine := RichEdit1.Perform(em_LineFromChar,-1, 0);

It worked fine to me.

Bye,
Itamar
0
 
LVL 4

Expert Comment

by:itamar
ID: 1361134
Hi,

one more thing: It also works with TMemo.

Bye,
Itamar
0
 
LVL 1

Author Comment

by:Greedy
ID: 1361135
Cool...that works, The reason I want the current line is so I can indent the line (paragraph) with the \li tag but how can I tell if this line is actually part of a paragraph.  Currently I have to open the file as a File of Char and then parse backwords until I hit a \li and if that line doesn't already have a \li then I have to go until I hit a \par  or a } plus I have to account for the posibility that the user has actually typed in \par or something so I have to look if the \ isn't really a \\ this is really a pain to have to code so much low level parsing plus doing the insert of the \li and then redisplaying it will get really slow on a big file.  The current input into these RichEdits is only about 5 lines so it's no big deal now but I was wondering how I could speed this up.  If there was a easy way to get all the text that is associated with a paragraph (every thing between one \par and the next) then I could do this parse really fast and insert it back without haveing to close the file, rewrite it and then load it again.
Thanks...

0
 
LVL 1

Author Comment

by:Greedy
ID: 1361136
Well,  after a bit of a total crap day tring to do low level formating of this file I decided to just use the WPTools that I got with LMD component kit.  Well worth the $120 bucks now that I have figured out how to work them.  Thanks, I'll give you the points because you did after all answer the question that I asked...
Thanks again.

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

920 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now