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.
Unfortunately, activation email could not send to your email. Please try again.

How to store/retrieve data into/from every symbol inserted by the user

Thread ID:





32822 Aug 8,2005 03:33 PM Aug 16,2005 09:45 PM Windows Forms 4
Tags: Diagram
Nikolaos Staes
Asked On August 8, 2005 03:33 PM

Hi, I have created three custom sumbols, named "Decision", "Chance" and "Value". Using these symbols user is able to create a diagram with links between them. 1.Everytime user clicks on a symbol, the program must understand the type of the symbol. (ie if it is a "chance" then display/create an instance of a "chance" class etc.) I have tried NodeClick and other diagram event handlers but it does not seem to distinguish that different kind of symbols are clicked. My design is that different forms of data must be kept with each specific symbol. Symbols of the same kind has to hold different data. Everytime user will click on a symbol, stored data will appear or prompt to enter new data. How am I going to manipulate user''s clicks on different symbols created? Any help would be much appreciated. Niko

Administrator [Syncfusion]
Replied On August 9, 2005 10:21 AM

Hi Niko, You should be able to use the Diagram.NodeClick event to examine the type of the node that was being clicked. The following code added to the DynamicSymbol sample produces the following trace about the symbol that was clicked, // NodeClick event handler private void diagram_NodeClick(object sender, Syncfusion.Windows.Forms.Diagram.NodeMouseEventArgs evtArgs) { Trace.WriteLine(evtArgs.Node.GetType()); } // Trace output Syncfusion.Windows.Forms.Diagram.Samples.DynamicSymbol.MySymbol As you can see, the Node''s type information is available, and you should be able to use this to differentiate between your symbol classes. This would be the easiest way to go about this issue. Regards, Prakash Surendra Syncfusion Inc.,

Nikolaos Staes
Replied On August 10, 2005 05:22 PM

Thank you Prakash Surendra, Although ''Trace'' didn''t work for me, I got the idea. I need to be more specific. 1.Is there a way to manipulate each node separately, even if it is of the same shape? 2.When user has finished with drawing his/her diagram, could I count how many rectangles, ellipses, links etc there are on the diagram? (not the sum of them) 3. What if user is not allowed to enter more than one of a specific symbol, let''s say a roundrectangle? Could I prevent the user of entering this node? Could you please give me some examples on the above 3 issues? Thank you in advance for your time, Niko

Administrator [Syncfusion]
Replied On August 11, 2005 03:51 PM

Hi Niko, 1. Have you considered using the Node.Name property to distinguish between the different symbol instances? You could simply assign distinct names to your symbols when they are being instantiated, and use the Name property to identify the node later. Another option would be to use the Syncfusion.Windows.Forms.Diagram.IPropertyContainer interface that the Symbol class implements to associate a custom ''identifier'' property with the symbol when creating it, and then using this identifier to pick out the symbol. Please refer to the Essential Diagram Class Reference docs on the IPropertyContainer interface for details on using the property container methods. 2. Essential Diagram does not keep track of individual nodes based on their type. To do this, you will have to iterate through the Diagram.Model.Nodes collection, and examine each node to identify it''s type, and use this to estimate the node distribution in your diagram. 3. You can prevent nodes from being selected by setting the Symbol/Shape.EditStyle.AllowSelect property to FALSE. Thanks, Prakash Surendra Syncfusion Inc.,

Nikolaos Staes
Replied On August 16, 2005 09:45 PM

Dear Prakash, it took a while but now I see what you mean. This was an exceptional kind of support. Thank you, Niko


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.