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
AD
Administrator
Syncfusion Team
August 9, 2005 02:21 PM UTC
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.,
NS
Nikolaos Staes
August 10, 2005 09:22 PM UTC
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
AD
Administrator
Syncfusion Team
August 11, 2005 07:51 PM UTC
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.,
NS
Nikolaos Staes
August 17, 2005 01:45 AM UTC
Dear Prakash,
it took a while but now I see what you mean.
This was an exceptional kind of support.
Thank you,
Niko