How to get all the text of a line from richviewEdit?

General TRichView support forum. Please post your questions here
Post Reply
alexandreq
Posts: 184
Joined: Wed Jan 18, 2012 6:22 pm

How to get all the text of a line from richviewEdit?

Post by alexandreq »

Hello,

There is a way to get all text from a line in RichEdit, but how to do this in richViewEdit?

In RichEdit I only do this:

Var
S : String;
Begin
S := RichEdit.Lines[0];
ShowModal(S)
End;

And in RichViewEdit?

Thanks
j&b
Posts: 184
Joined: Mon Sep 05, 2005 1:35 pm

Post by j&b »

One solution (memo has focus - TDBRichViewEdit)

procedure TForm1.btnTest1Click(Sender: TObject);
begin
memo.setfocus
memo.SelectCurrentLine; //in this case: 1st line
s:=memo.getseltext;
memo.deselect;
ShowMessage(s);
end;
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

You can use the functions from RVGetTextW.pas (or RVGetText.pas, if you need ANSI text).

Code: Select all

function GetCurrentLineText(rve: TCustomRichViewEdit): TRVUnicodeString;
function GetCurrentParaText(rve: TCustomRichViewEdit): TRVUnicodeString;
alexandreq
Posts: 184
Joined: Wed Jan 18, 2012 6:22 pm

Post by alexandreq »

hi sergey,

thanks for reply me.

How would you do this?

Specify a determined line and get a text from it?

like a function

rveGetLine(line) return string

should I move the caret to it and get the current line? But if I don't want move the caret? is there any solution?
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Do you need a line on the screen (that depends on wordwrapping/window size) or a paragraph (text between Returns)?
alexandreq
Posts: 184
Joined: Wed Jan 18, 2012 6:22 pm

Post by alexandreq »

I need to get a determined line from screen.
Post Reply