?
Solved

Get the current line number in a RichEdit

Posted on 1998-03-31
4
Medium Priority
?
401 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

718 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