SplitAnnotationRange on typing

2 posts, 0 answers
  1. Rick
    Rick avatar
    1 posts
    Member since:
    Mar 2011

    Posted 02 Apr 2015 Link to this post

    I have created a custom AnnotationRange following the CustomLayerAndCustomAnnotation example and I would like any text the user types in the editor to break this annotation range and only show content that was loaded with this range and never edited to show up in the range.

    I'm calling SplitAnnotationRange on the current AnnotationRange in a PreviewEditorKeyDown event handler after I have determined that they keypress was one that would insert content. The annotation range is split at the correct position but my cursor is not placed in the area of the split, it is at the start of the second range. If I call CaretPosition.MoveToPrevious the cursor ends up at the end of the first annotation range.

    I have tried all combinations of SkipPositionBefore on my start and end ranges but I believe the correct settings are False on the RangeStart and True on the RangeEnd which should make the position between a RangeEnd and a RangeStart a valid editable position.

    Is there any easier way to get content inserted by the user to automatically split my annotation range or to get the cursor to go into the position between the RangeEnd and RangeStart after SplitAnnotationRange.
  2. Petya
    Petya avatar
    983 posts

    Posted 07 Apr 2015 Link to this post

    Hello Rick,

    You are exactly right, whether or not the content between the two ranges is editable after the split entirely depends on the setup of the SkipPositionBefore/After of the annotation range. I'm afraid I couldn't advise on an easier approach to achieve the desired result.

    The scenario is interesting though and I will raise it for discussion with the development team. If there is demand for such functionality we may introduce annotations that will be automatically split when you start typing in them, instead of adding content inside the range.

    Let us know if you have other questions.


    See What's Next in App Development. Register for TelerikNEXT.

Back to Top