This is a migrated thread and some comments may be shown as answers.

How to get Caret to Show after Document loads?

2 Answers 15 Views
RichTextEditor
This is a migrated thread and some comments may be shown as answers.
Martin Hamilton
Top achievements
Rank 1
Iron
Iron
Veteran
Martin Hamilton asked on 07 Apr 2018, 10:40 AM

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 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 09 Apr 2018, 08:15 AM
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.
0
Martin Hamilton
Top achievements
Rank 1
Iron
Iron
Veteran
answered on 10 Apr 2018, 02:06 AM
Thank you very much.  So simple.  I couldn't see the forest for the trees I guess.  I appreciate your help
Tags
RichTextEditor
Asked by
Martin Hamilton
Top achievements
Rank 1
Iron
Iron
Veteran
Answers by
Dimitar
Telerik team
Martin Hamilton
Top achievements
Rank 1
Iron
Iron
Veteran
Share this question
or