How to position a cursor?


https://www.nevron.com/Forum/Topic8784.aspx
Print Topic | Close Window

By John Kurmann - 10 Years Ago
I want to position the cursor and automatically scroll the view to a specified line number or character position. How to achieve that?
By Nevron Support - 10 Years Ago
Hi John,
You can use the Goto method to position the caret on different text locations. For example:

m_RichText.Content.Goto(ENTextDocumentPart.Line, "11", true);

Positions the caret on the 11th line. You can use this method to position on page, section, paragraph, line and bookmark index. You can also position the caret using the selection object if you know the text position where you want to place the caret:

m_RichText.Selection.MoveCaretTo(someTextPosition, false);
m_RichText.EnsureCaretVisible();

Hope this helps - let us know if you meet any problems or have any questions.
By John Kurmann - 10 Years Ago
Thank you Support Team,
That works perfect!