Posted 20 years ago
by Greg Shaffer
- Boulder
![Avatar](https://secure.gravatar.com/avatar/33d583f12c2e3b9220cbb4e47c0f9567.jpg?s=64&d=identicon&r=g)
Hi Again,
Is there any way to be informed when the document changes for a code editor? If not, is it possible to make the Document virtual or add an event?
Thanks,
Greg
Some background...
I have a syntax editor where I set the document's language and look-and-feel in the constructor of the document. I do this in the constructor instead of in the designer because the language is static, and the designer doesn't help with that problem.
This works great, until I copy the syntax editor in VisualStudio design mode. In the InitializeComponent code for the copied syntax editor, the designer now thinks it needs to create a new document because I originally placed code in the codeeditor's constuctor.
This causes problems during runtime because the document has changed. This causes the language definition to be lost, etc...
So, it would be nice for my situation to be able to override "Document" in the syntax editor, or to be informed when the "Document" reference has changed.
In my case, if / when the document changes, I want to force the document to use my settings.
Is there any way to be informed when the document changes for a code editor? If not, is it possible to make the Document virtual or add an event?
Thanks,
Greg
Some background...
I have a syntax editor where I set the document's language and look-and-feel in the constructor of the document. I do this in the constructor instead of in the designer because the language is static, and the designer doesn't help with that problem.
This works great, until I copy the syntax editor in VisualStudio design mode. In the InitializeComponent code for the copied syntax editor, the designer now thinks it needs to create a new document because I originally placed code in the codeeditor's constuctor.
This causes problems during runtime because the document has changed. This causes the language definition to be lost, etc...
So, it would be nice for my situation to be able to override "Document" in the syntax editor, or to be informed when the "Document" reference has changed.
In my case, if / when the document changes, I want to force the document to use my settings.