Link to home
Start Free TrialLog in
Avatar of retep
retep

asked on

Actual linenumber in RichEdit.

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
Avatar of kretzschmar
kretzschmar
Flag of Germany image

hi retep,

there are a api function, which can be used

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

meikl
ASKER CERTIFIED SOLUTION
Avatar of TheNeil
TheNeil

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Here it is:

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


Yours,

Alex
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
Avatar of retep
retep

ASKER

I have choosen to use TheNeil's answer...

Thanks to all of you :)
Thanks Retep - Sorry everyone else

The Neil =:)