Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Get the current line number in a RichEdit

Posted on 1998-03-31
4
Medium Priority
?
440 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 200 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

885 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