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

Created link info....

Hi there, I''m trying to obtain link''s info on the diagram1_Model_ChildrenChanging event after I created a link using LinkTool. For some reason link doesn''t have FromNode and ToNode properties set. Is there a way to determine to/from symbols after link is created? Thanks, Leo

5 Replies

AD Administrator Syncfusion Team February 14, 2006 07:14 AM UTC

Hi Leo, The Diagram.Model.ConnectionsChanging and ConnectionsChangeComplete event will provide a notification when a link is being added or removed. And Examining the event argument will let you determine the type of operation, and the nodes that are involved in it. Please refer the following Essential Diagram KB article that shows in detail about using the ConnectionsChanging/ConnectionsChangeComplete events - http://www.syncfusion.com/support/kb/diagram/Default.aspx?ToDo=view&questId=34. Please let us know if you have any further queries on this issue. We will be glad to assist you. Thanks and Regards, Meera.


LR Leo Rabinovich February 15, 2006 05:35 PM UTC

Meera, thanks for your help. The link that you specified helped. Here is another related question: How do I determine/extract the ports on the symbols that the link is connected to? Thanks a lot, Leo > >Hi Leo, > >The Diagram.Model.ConnectionsChanging and ConnectionsChangeComplete event will provide a notification when a link is being added or removed. And Examining the event argument will let you determine the type of operation, and the nodes that are involved in it. > >Please refer the following Essential Diagram KB article that shows in detail about using the ConnectionsChanging/ConnectionsChangeComplete events - http://www.syncfusion.com/support/kb/diagram/Default.aspx?ToDo=view&questId=34. > >Please let us know if you have any further queries on this issue. We will be glad to assist you. > > >Thanks and Regards, >Meera.


AD Administrator Syncfusion Team February 16, 2006 06:18 AM UTC

Hi Leo, The event''s ConnectionCollectionEventArgs.Connection.SourcePort/TargetPort will give you the ports involved in the connection. And the ConnectionsChanging/ConnectionsChangeComplete events will be fired twice when creating a link - once each for the connection at each end of the link.If your intension is to determine the identity of the ports on the symbols that the link is connected to then you will have to handle the event when it generated the second time around, as the first occurrence of the event will provide you with access to only the ports involved in the first connection.You can determine whether the event is being fired for the first or second connection by accessing the link, and examining whether the Link.FromNode and Link.ToNode properties are valid. Please refer the following small sample code snippet which will give you an idea about the above mentioned informations. private void diagram1_ConnectionsChangeComplete(object sender, ConnectionCollectionEventArgs evtArgs) { Connection newconn = evtArgs.Connection; Link newlink = null; if(newconn.SourcePort is LinkPort) newlink = newconn.SourcePort.Container as Link; else if(newconn.TargetPort is LinkPort) newlink = newconn.TargetPort.Container as Link; if((evtArgs.ChangeType == Syncfusion.Windows.Forms.Diagram.CollectionExChangeType.Insert) && (evtArgs.Connection != null)) { if((newlink.FromNode != null) && (evtArgs.Connection.SourcePort.GetType() != typeof(LinkHeadPort))) { MessageBox.Show(evtArgs.Connection.SourcePort.ToString(),"SourcePort"); } if((newlink.ToNode != null)) { MessageBox.Show(evtArgs.Connection.TargetPort.ToString(),"TargetPort"); } } } I hope this helps you. Please let me know if you have any further questions. Thanks, Meera.


LR Leo Rabinovich February 17, 2006 02:25 PM UTC

Hi Meera, Whenever ConnectionsChangeComplete event gets called second time the TargetPort object would be the port on one of the symbols, but the source port is the LinkHeadPort of the link itself. Is there a way to determine the port of another symbol from the LinkHeadPort object? I suppose I could cash the port data each time the ConnectionsChangeComplete event is called and on the second time process it. Do you have any other solutions/suggestions? Thanks, Leo


AD Administrator Syncfusion Team February 24, 2006 03:02 PM UTC

Hi Leo, I am sorry about this delay in getting back to you on this issue. As for this, if your intension is to find the target port on a symbol then check whether the Link.ToNode is valid and if so get the SourcePort/TargetPort. Kindly look at the attached sample that shows the above mentioned informations. Please let us know if you have any further queries. We will be glad to assist you. Thanks for your support to Syncfusion. Regards, Meera.

CreatingLinks.zip

Loader.
Live Chat Icon For mobile
Up arrow icon