We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How can I set a diagram readonly?

Hi, How can I set the diagram to only allow viewing? but still keep tools like zooming and paning working. Best Regards Tommy

15 Replies

AD Administrator Syncfusion Team March 23, 2005 04:30 PM UTC

Hello Tommy, Diagram user interactivity is enabled through the interactive Tools registered with the Diagram''s Controller. To disable interactivity, you will have to iterate the list of Tools, and selectively enable/disable each tool depending on the functionality that you want to retain. The following code should give you an idea, // Get the collection of registered Tools, and disable functional aspects that are not required Syncfusion.Windows.Forms.Diagram.Tool[] tools = this.diagramComponent.Controller.GetAllTools(); foreach(Tool tool in tools) { // Retain the Enabled state for the Zoom and Pan tools if((tool.Name == "ZoomTool") || (tool.Name == "PanTool")) continue; tool.Enabled = false; } Regards, Prakash Surendra Syncfusion Inc,


TN Tommy Norman March 24, 2005 11:38 AM UTC

Okey thanks for the tool tip, However, how can I prevent users from droping new symbols into the diagram and how can I prevent them from moving symbols around. Of cource I could add a authority check in each diagram event handler but if there are a more elegant solution I would be glad. I was looking for some readonly property similar to what exists in the gridcontrol but haven''t found one. Setting the diagram to disabled fixes most of the issues but then I can''t zoom and I can scroll, this features I still want to have active. The reason for this need is that I have to build in support for usermanagement. If the user doesn''t have permission to edit he should still be able to view the diagram. Best Regards Tommy


TN Tommy Norman March 24, 2005 11:41 AM UTC

Sorry an error sneaked into my previous post. It should be "I can''t scroll". Regards Tommy


AD Administrator Syncfusion Team March 24, 2005 08:00 PM UTC

Hi Tommy, Disabling all the diagram interactive tools, except the Zoom and Pan as shown above, will disable the selection tool as well. Once the above method is invoked users will no longer be able to select nodes in the diagram, till the tools are re-enabled. The control''s scrolling behavior will not be affected in any way. To prevent new symbols from being dropped onto the diagram, simply set the diagram control''s Diagram.AllowDrop property to FALSE. Regards, Prakash Syncfusion Inc.,


AR Antonio Rodriguez Lezcano July 10, 2006 03:38 PM UTC

I did and worked, but now, with the last version doen''t exist any "Enable" property. I''ve tried with "DeactiveTool()" and setting null to "ActiveTool" but doesn''t work. How to do it in the current version? thanks >Hello Tommy, > >Diagram user interactivity is enabled through the interactive Tools registered with the Diagram''s Controller. To disable interactivity, you will have to iterate the list of Tools, and selectively enable/disable each tool depending on the functionality that you want to retain. The following code should give you an idea, > >// Get the collection of registered Tools, and disable functional aspects that are not required > >Syncfusion.Windows.Forms.Diagram.Tool[] tools = this.diagramComponent.Controller.GetAllTools(); >foreach(Tool tool in tools) >{ > // Retain the Enabled state for the Zoom and Pan tools > if((tool.Name == "ZoomTool") || (tool.Name == "PanTool")) > continue; > tool.Enabled = false; >} > >Regards, >Prakash Surendra >Syncfusion Inc, >


AD Administrator Syncfusion Team July 10, 2006 06:49 PM UTC

Hi Antonio, Thank you for using Syncfusion products. If your intension is to deactivate the currently active Tool then please, refer the following code snippet, // Activates the particular Tool. diagram.Controller.ActiveTool = /* particular Tool object */ // Automatically activates the SelectTool by default. diagram.Controller.ActiveTool = null; I hope I have not misunderstood your question. Please let us know if you have any queries regarding this issue. We will be glad to assist you. Thanks, Meera.


AR Antonio Rodriguez Lezcano July 12, 2006 03:07 PM UTC

What I want to do is set my diagram as read Only, just allowing functions like zoom. In previous versions I used your code going through every tool and setting enabled=false to those which I didn''t want to be used, but now there is no "enabled" property so I don''t know how to disable those tools for the read only behavior. > >Hi Antonio, > >Thank you for using Syncfusion products. > >If your intension is to deactivate the currently active Tool then please, refer the following code snippet, > >// Activates the particular Tool. > >diagram.Controller.ActiveTool = /* particular Tool object */ > >// Automatically activates the SelectTool by default. > >diagram.Controller.ActiveTool = null; > >I hope I have not misunderstood your question. Please let us know if you have any queries regarding this issue. We will be glad to assist you. > >Thanks, >Meera. >


AD Administrator Syncfusion Team July 12, 2006 08:35 PM UTC

Hi Antonio, If your intension is to activate only Pan and Zoom tool, you can do this by using either this.diagram1.Controller.ActiveTool property or this.diagram1.Controller.ActivateTool(...) method. I am sending you a sample application to show this code implementation. Kindly look at the attached sample''s toolBar1_ButtonClick() method which will give you an idea on what you are looking for. Thanks, Meera.

DrawShapes.zip


AR Antonio Rodriguez Lezcano July 18, 2006 04:37 PM UTC

My intention is put it as ReadOnly i.e. don''t allow the user move, insert or remove nodes for example. > >Hi Antonio, > >If your intension is to activate only Pan and Zoom tool, you can do this by using either this.diagram1.Controller.ActiveTool property or this.diagram1.Controller.ActivateTool(...) method. I am sending you a sample application to show this code implementation. > >Kindly look at the attached sample''s toolBar1_ButtonClick() method which will give you an idea on what you are looking for. > >Thanks, >Meera.

DrawShapes.zip


AD Administrator Syncfusion Team August 8, 2006 05:12 AM UTC


Hi Antonio,

We regret for this delay in getting back to you.

If your intention is to restrict the user from moving,inserting or removing the nodes then you can go with this by using the diagram.ChildrenChanging event.This event gets fired before the collection of child nodes are changed.Set the event arguments.Cancel property to true if you need to avoid inserting /removing the symbol nodes.Similarly, you can restrict the user from moving the nodes as well using the EditStyle.AllowMove property.

I have modified the above posted sample as per your requirement for your reference,kindly look into it and do let us know if we can be of further assistance to you.

Thank you for your patience.

Regards,
Praveena.

DrawShapes0.zip


AR Antonio Rodriguez Lezcano September 7, 2006 04:33 PM UTC

Doing it that way, I won''t be able either to insert or remove programatically. I don''t want the user to change the diagram but me.


J. J.Nagarajan Syncfusion Team September 20, 2006 11:29 PM UTC

Hi Antonio,

Sorry for the delay in getting back to you. If your intention is to insert or remove the symbols programmatically and restrict the user from moving , inserting or removing the nodes then please refer the attached sample. In this sample when you set the Diagram.AllowDrop property to false, then you can not drag the symbols from the palette.

Similarly, you can restrict the user from moving the nodes as well using the EditStyle.AllowMove property.

I hope this will meet your requirement. Please let me know if you have any questions

Thanks for using Syncfusion products.

Regards,
Nagaraj


ReadOnlyDiagram.zip



AR Antonio Rodriguez Lezcano September 25, 2006 09:43 AM UTC

How can I avoid the BitmapNode''s to be selected?


J. J.Nagarajan Syncfusion Team September 27, 2006 05:39 PM UTC

Hi Antonia,

Currently we have no special feature to set the Bitmap node as Readonly. However we will forward this issue to our development team and will implement this feature in our furure releases.

Thanks for your interest in Essential Diagram.

Regards,
Nagaraj


J. J.Nagarajan Syncfusion Team September 28, 2006 05:00 PM UTC

Hi Antonio,

Sorry for the inconvenience caused. If your intention is to avoid the bitmap node to be selected then please refer the attached sample. You can also avoid the bitmap to be moved by using the following code.

private void newDiagram_Controller_ToolActivate(object sender, Syncfusion.Windows.Forms.Diagram.DiagramController.ToolEventArgs evtArgs)
{
if(evtArgs.Tool.Name=="MoveTool" && this.newDiagram.SelectionList.First is BitmapNode)
{
MoveTool tool=(MoveTool)evtArgs.Tool;
this.newDiagram.Controller.ActiveTool=null;
}
}

I hope this will meet your requirement. Please let me know if this helps for you.Thanks for using Essential Diagram.

Regards,
Nagaraj

BitmapNodeSelection.zip



Loader.
Up arrow icon