An issue about incorrect caret position caused by bookmark needs your help.
The issue can be reproduced as follows:
1. create multiple paragraphs
2. add bookmarks at the beginning in paragraphs
3. put the cursor at the left margin area of the start line in a paragraph
which bookmark locates, click left button
Then the caret will be set to the end of the previous paragraph.
But click again, the caret locates in the correct position.
That is, two clicks are needed to set the correct caret position.
It will also cause the problem of incorrect selection which will select previous paragraph.
( This issue can be reproduced in the online demo.)
Thanks,
Best,
Tuo
5 Answers, 1 is accepted
The problem is that bookmarks essentially don't have a position before them, i.e. when you navigate in the document using the arrows, moving the caret before a BookmarkRangeStart will move it in the previous valid position, which in your example is at the end of the previous paragraph. The same thing applies when obtaining the position from the place in the document you have clicked.
We have logged the issue for further investigation, to see if there is some way to handle such cases .
Please, excuse us for the inconvenience.
Vasil
the Telerik team
Is there any solutoin found for this incorrect caret position when bookmark starts the paragraph?
From the latest demo of RadRichTextbox, the problem is still there.
We appreciate your help if the issue can be fixed since the bookmarks are heavily used to identify the content in our application.
Thanks.
Best,
Tuo
Unfortunately, this issue is not addressed yet, but you can track the progress and vote for it (to increase its priority) in our public issue tracking system here.
Don't hesitate to contact us if you have other questions.
Vasil
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Is there any way to work around this issue? Such as adjust the caret position in MouseLeftButtonDown.
Through the RadRichTextBox.ActiveEditorPresenter.GetDocumentPositionFromViewPoint(point), the correct document position can be captured. Is there anything can be done based on the correct DocumentPosition to put the caret in correct position or get the correct selection?
example:
Public Sub OnMouseLeftButtonDown( sender As Object, e As System.Windows.Input.MouseButtonEventArgs)
dim rtb= CType(sender, Telerik.Windows.Controls.RadRichTextBox)
dim currentPos as DocumentPosition = rtb.ActiveEditorPresenter.GetDocumentPositionFromViewPoint(e.GetPosition(rtb))
......
Thanks.
Best,
Tuo
ActiveEditorPresenter.GetDocumentPositionFromViewPoint
There is no way to workaround the problem with the current version of the controls, as the problem lies in the way that the editor gets the document position from the mouse point when there is an annotation marker.
This is due to the fact that annotation markers (such as bookmark range start) are not included in the "walk of the caret" and the way the editor decides if text typed at the position of the marker should be included in the range. You can follow the PITS issue that Vasil posted a link to in his previous reply in order to be notified when the issue is resolved.
Iva Toteva
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.