How to get Caret to Show after Document loads?

3 posts, 0 answers
  1. Martin Hamilton
    Martin Hamilton avatar
    25 posts
    Member since:
    Aug 2009

    Posted 07 Apr 2018 Link to this post

    I've tried several examples from this forum to try to get the flashing caret to appear in a loaded document but no matter what I do nothing seems to work.

    For example:

                RadRichTextEditor2.CaretWidth = 1
                Dim position As DocumentPosition = RadRichTextEditor2.Document.CaretPosition
                RadRichTextEditor2.Document.CaretPosition.MoveToLastPositionInDocument()
                RadRichTextEditor2.RichTextBoxElement.VerticalScrollBar.Value = RadRichTextEditor2.RichTextBoxElement.VerticalScrollBar.Maximum
                position.MoveToNext()

    I think the caret is at the end of the last paragraph but until I actually click on the document and hit the space bar or start typing, the Caret is not visible...

    I'm sure there's a simple way to get the flashing Caret to automatically appear but it evades me.  Does anyone know how to do this?

  2. Dimitar
    Admin
    Dimitar avatar
    2713 posts

    Posted 09 Apr 2018 Link to this post

    Hello Martin,

    You need to make sure that the editor is focused. Here is an example that shows this:
    Private Sub radButton1_Click(ByVal sender As Object, ByVal e As EventArgs)
        Dim doc = New RadDocument()
        Dim editor = New RadDocumentEditor(doc)
        editor.Insert("Test")
        radRichTextEditor1.Document = doc
        radRichTextEditor1.Document.CaretPosition.MoveToFirstPositionInDocument()
        radRichTextEditor1.Focus()
    End Sub

    I hope this will be useful.

    Regards,
    Dimitar
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Martin Hamilton
    Martin Hamilton avatar
    25 posts
    Member since:
    Aug 2009

    Posted 09 Apr 2018 in reply to Dimitar Link to this post

    Thank you very much.  So simple.  I couldn't see the forest for the trees I guess.  I appreciate your help
Back to Top