Posted 14 years ago by Steve GW
Version: 9.2.0510
In a basic RichTextBox it is possible to add tag properties.

I was looking to use the syntax editor in a lightweight way and need to add hidden information around a span like context which I don't think is avaliable in the syntax editor.

I want to indicate to a user that the text span under the cursor is not edittable.

In a rich text box you can do things like see below ... is there anything similair?

My use model maybe more richtextbox like but the syntax editor has so much more to offer that a basic editor.

if (IsPositionContainedBetween(rtb.CaretPosition, startP, endP))


// This method first checks for compatible text container scope, and then checks whether
// a specified position is between two other specified positions.
        bool IsPositionContainedBetween(TextPointer positionToTest, TextPointer start, TextPointer end)
// Note that without this check, an exception will be raised by CompareTo if positionToTest 
// does not point to a position that is in the same text container used by start and end.
// This test also implicitely indicates whether start and end share a common text container.
            if (!positionToTest.IsInSameDocument(start) || !positionToTest.IsInSameDocument(end))
                return false;

            return start.CompareTo(positionToTest) <= 0 && positionToTest.CompareTo(end) <= 0;

Comments (1)

Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Hi Steve,

Version 2009.2 (released a couple weeks ago) added a robust tagging mechanism that lets you associate any custom data with text ranges. It sounds like it's exactly what you need.

Actipro Software Support

The latest build of this product (v24.1.2) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.