GoPort

Is it possible to catch the child node position of a link ?
Right Now i can catch the parent but not the child…

Ex working…

GoLink l = (GoLink)e.GoObject; if(l.FromNode.GoObject.ToString() == "bxVortex.bo.GoDecision") { GoDecision parentNode = (GoDecision)l.FromNode; rightPort = parentNode.RightPort.IsLinked(l.ToPort); leftPort = parentNode.LeftPort.IsLinked(l.ToPort); topPort = parentNode.TopPort.IsLinked(l.ToPort); bottomPort = parentNode.BottomPort.IsLinked(l.ToPort);

ex not working

if(l.ToNode.GoObject.ToString() == "bxVortex.bo.GoDecision") { GoDecision childNode = (GoDecision)l.ToNode; rightPort = childNode.RightPort.IsLinked(l.FromPort); leftPort = childNode.LeftPort.IsLinked(l.FromPort); topPort = childNode.TopPort.IsLinked(l.FromPort); bottomPort = childNode.BottomPort.IsLinked(l.FromPort); We don't hve the position of the child one... Is it the good method to do???

Thanks…

First, an unrelated observation: it’s unwise to convert an object to a string to find out what type it is. In C# you should be using the “is” and “as” operators. Your predicate ought to be like:
if (l.FromNode is GoDecision) { … }
or better yet:
GoDecision parentNode = l.FromNode as GoDecision;
if (parentNode != null) { … }
Second, links are directional. The argument to GoPort.IsLinked should always be the destination port that you are checking, i.e. a port that will be the ToPort of a link whose FromPort is this port.
Third, if you are trying to figure out for a link which port it connects at, it would be easier to do:
GoDecision childNode = l.ToNode as GoDecision;
if (childNode != null) {
rightPort = l.ToPort == childNode.RightPort;
leftPort = l.ToPort == childNode.LeftPort;
topPort = l.ToPort == childNode.TopPort;
bottomPort = l.ToPort == childNode.BottomPort;
}
Note that this code also handles the case where the GoDecision node doesn’t happen to have one or more of the usual ports.
Fourth, you might find it useful to read the section in the User Guide about Traversing a Diagram.

Thanks!!