Solved

Actual linenumber in RichEdit.

Posted on 2000-04-25
6
145 Views
Last Modified: 2013-11-22
How do I find out in which linenumber my cursor is placed in a TRichEdit?

I need it, because I need to insert some text with the

Richedit1.lines.insert(<here>,'MyString');

If you have better idéas for inserting text from the cursor, that will be an answer too.

Thanks.
Retep
0
Comment
Question by:retep
6 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 2747830
hi retep,

there are a api function, which can be used

or use richedit1.seltext := YournewText + #10;

meikl
0
 
LVL 5

Accepted Solution

by:
TheNeil earned 50 total points
ID: 2747831
Use the CaretPos property of the RichEdit component. In your case your call to Insert needs to be

RichEdit1.Lines.Insert(RichEdit1.CaretPos.Y, 'MyString');

The Neil =:)
0
 
LVL 15

Expert Comment

by:simonet
ID: 2747841
Here it is:

function GetRow: Longint;
begin
  with reEdit do
    Result := Perform(EM_LINEFROMCHAR, -1, 0)+1;
end;


Yours,

Alex
0
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.

 
LVL 27

Expert Comment

by:kretzschmar
ID: 2747856
hi again,

the other solution

  Richedit1.Lines.Insert(Richedit1.Perform(EM_LINEFROMCHAR,Richedit1.Selstart,0),'Thats the New Line');

be sure that the richedit-unit is in your uses clause

meikl
0
 

Author Comment

by:retep
ID: 2747893
I have choosen to use TheNeil's answer...

Thanks to all of you :)
0
 
LVL 5

Expert Comment

by:TheNeil
ID: 2747942
Thanks Retep - Sorry everyone else

The Neil =:)
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

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…
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…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
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: …

746 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

12 Experts available now in Live!

Get 1:1 Help Now