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

Incorrect caret position when bookmark is at the begnning of the paragraph

5 Answers 121 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Tuo
Top achievements
Rank 1
Tuo asked on 14 Mar 2012, 02:59 PM
Hello Telerik,
   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

Sort by
0
Vasil
Telerik team
answered on 20 Mar 2012, 10:00 AM
Hi Tuo,

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.

Kind regards,
Vasil
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Tuo
Top achievements
Rank 1
answered on 11 Jun 2012, 06:26 PM
Hello Telerik,
         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
0
Vasil
Telerik team
answered on 14 Jun 2012, 01:32 PM
Hello 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.

Greetings,
Vasil
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Tuo
Top achievements
Rank 1
answered on 16 Jul 2012, 08:26 PM
Hi Vasil,    
       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))         
                ......

      End 

Thanks.
Best,
Tuo
   

ActiveEditorPresenter.GetDocumentPositionFromViewPoint


      
0
Iva Toteva
Telerik team
answered on 19 Jul 2012, 03:47 PM
Hello Tuo,

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.
 

All the best,
Iva Toteva
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
RichTextBox
Asked by
Tuo
Top achievements
Rank 1
Answers by
Vasil
Telerik team
Tuo
Top achievements
Rank 1
Iva Toteva
Telerik team
Share this question
or