Set Cursorposition (Line, Col) in RichViewEdit

General TRichView support forum. Please post your questions here
Post Reply
AsteruxBT
Posts: 2
Joined: Mon Aug 09, 2021 5:03 am

Set Cursorposition (Line, Col) in RichViewEdit

Post by AsteruxBT »

Hello,

I copy a text 1:1 from a RichViewEdit to a DBRichViewEdit and then I want to stand with the cursor in the DBRichViewEdit at the same position in the text as before in the RichViewEdit.
With the function: GetCurrentLineCol(Row,Col) I get the current row and column in the text.
But how can I set them again.
A command like SetCurrentLineCol does not exist.

Can someone help me here?

Greetings from Bavaria in Germany
AsterixBT
Sergey Tkachenko
Site Admin
Posts: 17253
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Set Cursorposition (Line, Col) in RichViewEdit

Post by Sergey Tkachenko »

The simplest way is using functions from RVLinear unit

If you need only to store the caret position, use RVGetLinearCaretPos and RVSetLinearCaretPos.

If you want to store not only the caret position, but also selection, use RVGetSelectionEx/RVSetSelectionEx.
AsteruxBT
Posts: 2
Joined: Mon Aug 09, 2021 5:03 am

Re: Set Cursorposition (Line, Col) in RichViewEdit

Post by AsteruxBT »

Hello,

thank you very much for the answer.
RVGetLinearCaretPos and RVSetLinearCaretPos worked fine in the first test.

Greetings from Bavaria in Germany
AsterixBT
Post Reply