This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi, could you help me to reach another node connected to the node I'm working on? I'm explaining. If I do :
It doesn't work because it's a wrong syntax. Can you give me the right one? Thank you |
|
|
Hello Leon The first part of your code is correct:
This will get the first connection-point on the node. Next, you need to get the connection that is connected to this point. This can be done through the Connections property of the connection-point. Note that a connection-point can have multiple connections connected to it, and also, make sure that the Connections collection is not empty before you try to get a connection from it. Once you have a connection, the next part is a little tricky. A connection has a connection point at each end. One can be gained through the FromConnectionPoint property, and the other through the ToConnectionPoint property. One of these connection points is going to be the connection-point on the node that you already started from, and the other connection-point is on the node that you are trying to get. So you need to work out which of these 2 properties has the connection point that you already have, and then pick the other connection-point. Once you have this, simply cast the Connectable property value of the connection-point into an IDiagramNode, and this will be the node at the other end of the connection. Here is an example that I think does what you want:
If you need to use this similar logic in many places, you may want to put this code in a static helper method. Let me know if you have any questions about this. -Jason Fauchelle |
|
|
Works perfectly, thank you. |
|