Implementing "Hidden" and "Read-Only" Regions

SyntaxEditor for Windows Forms Forum

Posted 19 years ago by Rowland Friebely
We are evaluating SyntaxEditor, and would like to create "read-only" and "hidden" text regions.

For a "hidden" region, we would like to be able to:

1) Change the background of "hidden" region box, representing the collapsed section, to "black" and the foreground to "white".
2) Prevent the "hidden" region box from being expanded - keep text hidden.
3) Suppress the outline tooltip only for the hidden region.

For a "readonly" region, we would like to be able to:

1) Change the background of the "readonly" region box to light-blue.
2) Prevent the user from editing the text in this region, when expanded. (or part of a selection process)
3) Change the text background to light-blue, when expanded.

How would I approach modifying the SyntaxEditor to support this capability?

Comments (1)

Posted 19 years ago by Actipro Software Support - Cleveland, OH, USA
Hi Rowland,

For hidden...
1) You can do this by updating the CollapsibleTextStyle in the language definition. Look at our C# sample def for how to do that.
2) There currently isn't a way to "disable" an outlining box. I can add that to the TODO list.
3) In the TokenMouseHover event you can control what tip displays. If you don't want to show an outlining tooltip, you can set the e.ToolTipText to null to suppress it when e.IsCollapsedNode is true.

For read-only...
You can add span indicators to modify appearance of text regions however there currently isn't a built-in way to make read-only regions. SyntaxEditor can set an entire document as read-only but not regions. That is on the TODO list though. You might be able to get it working with the current version manually by handling events like KeyTyping and PasteDragDrop and cancel them if crossing a read-only range.

Actipro Software Support

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

Add Comment

Please log in to a validated account to post comments.