Read-Only IDE Window

Q:

 

Is it possible to show users a VSTA IDE window but prevent them from editing the code?

 

 

 

A:

 

It may be possible to do this by calling IVsTextBuffer.SetStateFlags() with BUFFERSTATEFLAGS.BSF_USER_READONLY.

If that doesn’t work, you could try creating a readonly line marker that encompasses the entire document. Do that by calling IVsTextLines.CreateLineMarker, with the MARKER_READONLY type. -- I think there’s an example of this in the IronPythonIntegration sample. If you search on CreateLineMarker, you should find an example of this.

You'll need to get these services via the DTE

This blog post may help.

 

 

 


Posted Jun 19 2009, 02:33 PM by BillL
Filed under: , ,
Copyright Summit Software Company, 2008. All rights reserved.