iCSharpcode Texteditor control

  • Thread starter Thread starter Ray Cassick \(Home\)
  • Start date Start date
R

Ray Cassick \(Home\)

Has anyone here used this control in their own product at all?

I am very interested in some sample code that shows how to implement a
folding strategy so I can do code regions in my custom language.

I know how to use the folding manager to get code segments to fold up into
collapsible regions but I cannot figure out how to know when a user enters
in a line that I want to setup as a foldable bit of code. I have a construct
in my script language defined as RuleSets and these are delimited by the
opening keyword '#RuleSet'. When someone types that word and hit enter I
would like to add in the corresponding '#EndRuleSet' and then set folding up
between these lines automatically.

My big problem is that I cannot seem to get any type of key events out of
that control so I have no idea how I am supposed to trigger anything when
the user it typing.
 
Ray said:
I am very interested in some sample code that shows how to implement a
folding strategy so I can do code regions in my custom language.

This is not handled within the TextEditor itself. This is handled by
the Parser, which is external to the TextEditor. You can check
Parser.cs and ParserFoldingStrategy.cs.

The TextArea control has key events you can hook, and this is within
the TextEditor. See TextArea.cs.

You probably don't need your own parser but it helps performance,
especially if you want to support other "smart" features within the
editor. Testing keys is only part of the battle because you have to
know the context. And this is what the parser handles.

Eric
 
Thanks.

Eric said:
This is not handled within the TextEditor itself. This is handled by
the Parser, which is external to the TextEditor. You can check
Parser.cs and ParserFoldingStrategy.cs.

The TextArea control has key events you can hook, and this is within
the TextEditor. See TextArea.cs.

You probably don't need your own parser but it helps performance,
especially if you want to support other "smart" features within the
editor. Testing keys is only part of the battle because you have to
know the context. And this is what the parser handles.

Eric
 
Back
Top