Sharing a SyntaxLanguage?

SyntaxEditor for Windows Forms Forum

Posted 20 years ago by shark92651
Avatar
I see that in order to save memory I should "share the same instance of the SyntaxLanguage" between multiple instances of SyntaxEditor. How do I do this? The documentation is pretty parse in this area and the sample application just makes a call to LoadLanguageFromXML. Does anyone have any examples that demonstrate how best to manage languages? <IMG SRC="confused.gif" border="0">

Comments (1)

Posted 20 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
It's really easy... in the Documentation look at this topic:
Language Definition Guide -&gt; Loading and Saving

There are static methods on the SyntaxLanguage class that let you load a language independent of an editor. Once you have that, just set it to the SyntaxEditor.Language property of every SyntaxEditor that should use it.

In the new 2.5 version we're working on right now, we're allowing Documents to be separated out from the user interface and even loaded and parsed independently of a SyntaxEditor. In that version the Language property is being moved to the Document class. This will be a really handy feature because then you can load a file into a Document, parse it with a SyntaxLanguage, and iterate through its tokens without even needing to load any SyntaxEditor control!


Actipro Software Support

The latest build of this product (v24.1.0) 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.