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

6 posts, 0 answers
  1. Tuo
    Tuo avatar
    20 posts
    Member since:
    Oct 2011

    Posted 14 Mar 2012 Link to this post

    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
     
  2. Vasil
    Admin
    Vasil avatar
    124 posts

    Posted 20 Mar 2012 Link to this post

    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 >>
  3. DevCraft banner
  4. Tuo
    Tuo avatar
    20 posts
    Member since:
    Oct 2011

    Posted 11 Jun 2012 Link to this post

    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
  5. Vasil
    Admin
    Vasil avatar
    124 posts

    Posted 14 Jun 2012 Link to this post

    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 >>

  6. Tuo
    Tuo avatar
    20 posts
    Member since:
    Oct 2011

    Posted 16 Jul 2012 Link to this post

    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


          
  7. Iva Toteva
    Admin
    Iva Toteva avatar
    1319 posts

    Posted 19 Jul 2012 Link to this post

    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.

Back to Top
DevCraft banner