Disallow link problem


I have created a GoIconicNode with the port overridden such that I can override CanLinkFrom in order to disallow outbound linking in some dynamic circumstances. However when I drag a link out of such a port, CanLinkTo is the override that gets called, and, in addition, the link is permitted no matter what is returned from either handler. Any ideas on what may be my problem?


The linking tool checks all nearby ports for the validity of making a link, and that includes reflexive (self) links.


I’ll state the problem in another way. I replace the port of a GoIconic node and set the IsValidSelfNode property to false. If I override both port.CanLinkFrom and port.CanLinkTo to return false, I can still link in and out of the port. Is this designed behavior, or does it indicate some other error on my part.
The objective is to be able to determine linking behavior dynamically, when it is not convenient to set the IsValidFrom/To properties. Is there a better way to go about this than what I’ve done then?


I just tried overriding both GoPort.CanLinkFrom() and CanLinkTo() to return false, and found that I as a user could not start drawing any link from such ports, and that I couldn’t connect to them from some other kind of port where I could start drawing a new link.
Of course, you as a programmer can still create links between such ports programmatically.


Thank you, your information was valuable in that it told me I needed to look for an error I had introduced. The problem was that there were in fact two ports, the one I had created, and one created later by Go. Of course, overriding the CreatePort method is the solution.