How to set diagram read only?


https://www.nevron.com/Forum/Topic8670.aspx
Print Topic | Close Window

By Boon Kean Chin - 10 Years Ago
How to set diagram read only, not allowing user to make any changes to the document? Have to loop all the elements in the diagram?
By Nevron Support - 10 Years Ago
You have several options:

1.  Loop all elements and set the respective protections
2. Disable the respective tools  - for example the following code disables the Move tool:

NTool tool = drawingView.Controller.Tools.GetToolByName(NDWFR.ToolMove);
tool.Enabled = false;

3. One dirty trick to disable modifcations is to set an invalid id to the ActiveLayerUniqueId property:
m_View.document.ActiveLayerUniqueId = Guid.NewGuid()

Tools that modify the document always take the active layer into account. If you do not have an active layer, user cannot modify or select anything.