Locking one of the Editor's logical views at runtime
I have implemented a editor using MPF. The editor provides two logical views, a debug view, and a designer view. I would like to have the designer view locked (i.e. it's still shown as one of the tabs but user cannot save) when I have the debug view opened. I have tried setting the locks on Running Document Table, but it seems like RDT cannot lock individual logical view of the same document. Is there any way to provide the desired behavior?
Thanks.
[457 byte] By [
vchu] at [2007-12-17]
If by "lock" you mean "making it not possible to save", then this is not a view-specific concept. Saving (or not saving) is performed on a document-basis (not a per-view basis). There is the RDT_CantSave (= RDT_DontSave | RDT_DontSaveAs) flags that can be set on a document in the Running Document Table. If these flags are set, then the File.Save and File.SaveAs commands will be disabled for this document.
It is possible to modify some of the flags on entries in the Running Document Table via IVsRunningDocumentTable::ModifyDocumentFlags dynamically. Thus I could imagine that you set the RDT_CantSave flags for your document entry when the debug view is opened, and clear then again when it is closed. I believe this is what you are asking for.
I am concerned however if the user does File.Exit when the Debug view is open, it seems that the user might loose data because they were not allowed to save the file. You should test this scenario and make sure this works properly.