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

SplineTool and PolyLineLinkTool -> event when two nodes are connected

Hi there,
I'm evaluating Syncfusion Diagram Windows. I'm sorry for my insistence.
I’m trying to use SplineTool and PolyLineLinkTool to connect two nodes. I saw CoolLinks_2008 example to see how.
I’ve got some problems:
1. Activating the PolyLineLinkTool using this.diagram1.ActivateTool("PolyLineLinkTool"); command in my test Application, nothing happens, while the same command in the axample activates the tool; the polyLineBase object (that I tried to use to apply a decorator is null PolyLineBase line = this.diagram1.Controller.ActiveTool as PolyLineBase;). What I’m missing?

2. A base feature for my diagram application is to know which nodes a new connector is connecting. In a previous post you kindly indicate the way to do it. I used the same way using SplineTool to connect nodes, but the indicated way doesn’t work as the endpoint container is not ConnectorBase derived but is a SplineNode (see code)
void EventSink_ConnectionsChanged(CollectionExEventArgs evtArgs)
{
switch (evtArgs.ChangeType)
{
case CollectionExChangeType.Clear:
break;
case CollectionExChangeType.Insert:
EndPoint conPoint = evtArgs.Element as EndPoint;
ConnectorBase con = conPoint.Container as ConnectorBase; //NULL if I use SplineTool
break;
case CollectionExChangeType.Set:
break;
default:
break;
}
}

How can I solve the problem to get nodes that a Spline or PolyLine Connector type connects?

Thank you for your patience
Best Regards
Domenico

6 Replies

DM Domenico Mozzone December 4, 2009 03:58 PM UTC

Dear Syncfusion Supprot,
waiting for your kind reply I made more experiments with Syncfusion Diagram Windows.
Till now I’m not able to use SplineTool to connect two nodes and to know which of them the Spline connector connects. Well I’ll use other connector types.
Now I’m going on testing some other features that I would like to use.
In particular I’m trying to use a custom connector derived from LineConnector or OrthogonalConnector. I successfully create the custom connector, but I can’t activate it to be used by user.
Can you help me?
Best Regards
Domenico


DM Dinesh M Syncfusion Team December 4, 2009 05:13 PM UTC

Hi Domenico,

Sorry for the delay in getting back to you.

The SplineTool creates "SplineNode" which is not derived from "ConnectorBase" class and hence it will not connect nodes at the time of drawing using the tool. To create customized line connector using a tool than we should customize the corresponding tool also. Please check the following online document on customizing the Tool class.

http://help.syncfusion.com/ug_74/diagramwin/HowToChangeTheColorOfTheLineConnectorWhenActivatingTheLineTool.html

Regards,
Dinesh


DM Domenico Mozzone December 9, 2009 12:18 PM UTC

Hi Dinesh,
thank you for your reply.
My question was not clear so the provided example was not so helpful.
I done some more tests and now I’m trying to formulate the question in a better way.

I would like to connect to custom symbols with a custom connector through custom ports. The aim is to have a list of connectors with information about symbols connected and ports used.

The custom symbol has a property that represents its ID and a certain number of ports with unique ID too (see attached code).
The custom connector, LineConnector derived, has two properties the port From and port To.

Connecting two symbols with the first connector all is right.
Connecting the same two symbols with another connector something goes wrong:
- ConnectionsChanged event fires twice, (inspecting code it seems that edges of From node are incongruent)
- The first connector disappears.
I can’t explain such behavior. Can you help me?
I believe that something is missing in my code building the LineConnectorCustom and its Tool.
Where I can find a complete example showing how to build a custom connector and custom tool to activate it?
I’ve attached my example code. A message box appears after adding the second connector as the ConnectionsChanged event fire twice.
Best Regards
Domenico




TestCustom_e682f937.zip


DM Dinesh M Syncfusion Team December 16, 2009 02:00 PM UTC

Hi Domenico,

Sorry for the inadvertent delay in getting back to you. The connection changed event will be fired twice while connecting with the tool since it works w.r.t to the endpoints of the connector. I couldn't able to get the exact reason for disappearing first connector, but it looks that the second connector tries to connect to the first connector. Try setting the EnableCentralPort property of connector to false. Currently we do not have a sample that has a combined customization of classes apart from the individual functionality samples I have provided in your other forum postings.

Regards,
Dinesh


DM Domenico Mozzone December 17, 2009 06:15 AM UTC

Thank you Dinesh for your reply.
Meanwhile I have solved the problem taking a different way.
Best regards
Domenico


DM Dinesh M Syncfusion Team December 17, 2009 02:48 PM UTC

Hi Domenico,

Thanks for the information.

Regards,
Dinesh

Loader.
Live Chat Icon For mobile
Up arrow icon