Solved

Get the current line number in a RichEdit

Posted on 1998-03-31
4
306 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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

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…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

747 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

10 Experts available now in Live!

Get 1:1 Help Now