Solved

Get the current line number in a RichEdit

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

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 my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

815 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

7 Experts available now in Live!

Get 1:1 Help Now