How do i make a line (or lines) readonly.

SyntaxEditor for Windows Forms Forum

Posted 16 years ago by GeorgeNY - CTO, RatchetSoft, LLC
I would like to make certain lines readonly.

Using this example:

1. using XYZ;
2. public class MyClass
3. {
4. public void MyMethod1()
5. {
6 do smth;
7. do smth else;
8. }
9. public void MyMethod2()
10. {
11. do smth;
12. do smth else;
13. do even more;
14. }
15. }

I would like to make lines 1-5 and 8-10 and 14-15 readonly, thus allowing the user to modify only the contents of one of the 2 C# methods. Line numbers will not work, because the user will be adding many lines within each method. I thought there may be something with SpanIndicators?

Please provide details.

George P Weihs

Comments (4)

Posted 16 years ago by Boyd - Sr. Software Developer, Patterson Consulting, LLC
This has been requested in the past, and there is no current solution for making parts of the document read-only. I believe it has been added to the TODO list.
Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Yes that is still on the TODO list.

Actipro Software Support

Posted 16 years ago by Boyd - Sr. Software Developer, Patterson Consulting, LLC
If you're still trying to think of how to implement this feature, I think a read-only Span Indicator would be a good approach. The collapsed text for an outlining node appears to already behave that way, so it'd be a good start.

Either way, I'm sure you'll figure it out. <IMG SRC="biggrin.gif" border="0">
Posted 16 years ago by painetraine
Or, in addition to spans, allow the user to specify LexicalStates as being read only. I have several states that I insert manually and don't want the user to Edit. I currently try to capture keystrokes in the state but that doesn't work all the time.

So maybe 3 read only methods:

1. Line
2. Spans
3. Lexical States

The latest build of this product (v21.1.0) was released 18 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.