Solved

Actual linenumber in RichEdit.

Posted on 2000-04-25
6
149 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
Independent Software Vendors: 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

Independent Software Vendors: 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

Suggested Solutions

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…
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

737 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