Solved

Actual linenumber in RichEdit.

Posted on 2000-04-25
6
150 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
[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
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

705 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