Changing link behavior

Hi,



I have a question concerning link behavior. Sure the solution is “Easy! Do override the following mehthod:”, but I cannot see it at the moment (Hi walter )



I am doing GoLabeledLinks between GoBasicNodes. I created a LinkPrototype class and registered it to my GoView using the NewLinkClass property.



Lets say we have node A and B.



At the moment I have a fairly normal behavior:



- Go over A’s port, press the left button, drag the link to B, release the button -> link created.

- Release the button over an empty space in the document -> link disappears.



By this, there can be only valid links linking objects. To add intermediate points to the link I implemented a context menue (like in demo1).



My beta-tester is complaining about this. He wants to set up intermediate points while creating the link like this:



- Go over A’s port, press the left button, drag the link to B, release the button -> link created.

- Release the button over an empty space in the document -> create an intermediate point and continue with the link. Press the left button again -> another intermediate point. The link can only be completed/created by pressing the left button over a valid target (B).



I have no idea how to do this. Can somebody please give me a little hint about the required structure?



Thanks in advance.



Regards,

Henning



Easy! Just use the RoutingLinkTool implemented in the Demo1 sample.

Thanks for your answer. But it does not work out well:



My code is inspired by the network examples in demo1. I have a LinkPrototype class (derived from GoLabeledLink) with my customized link appearance and behavior which is registered to my view by using the NewLinkClass property.



How do I convince the routing tool from demo1 to create links based on my LinkPrototpye and not ordinary GoLinks?



Another annoying behavior I have no idea how to solve:



I am connecting GoBasicNodes. One shaped as a circle (called PlaceNode) with a round GoPort in the middle, one (called TransitionNode) shaped as a Rectangle (by overwriting CreateShape). The rectangle shaped node should only allow connections coming in/out at the longer side of the rectangle. This is done by a customized TransitionNodePort with overrides to GetToLinkPoint and GetFromLinkPoint (like in demo1).



When creating a link from a PlaceNode to a TransitionNode, the link starts in the middle of the port (AKA exactly in the middle of the GoBasicNode), becomes visible when leaving the PlaceNode and ends at the TransitionNode. When I now move the place node around, the link origin starts to jump around moving to the outer circle of the GoPort:



Correct behavior:







Wrong behavior:









How can I make sure, the link always originates exactly in the middle of the PlaceNode?



I tried to override the PlaceNode and added



this.FromSpot = GoPort.NoSpot;

this.ToSpot = GoPort.NoSpot;



to the overridden port but this does not help. There are no overrides to the FromPoint/ToPoint methods of the PlaceNode.



Thanks for any ideas!



Regards,

Henning

BTW: I dont know if it is a feature or a bug, but when overriding CreatePort in my GoBasicNode-derived classes, the node becomes larger, altough the port has the same settings as before (!).







on the left side, the PlaceNode with CreatePort overridden, on the right side the same class without overridden CreatePort. No idea, why the left object is larger.



Regards,

Henning

[quote]My code is inspired by the network examples in demo1. I have a LinkPrototype class (derived from GoLabeledLink) with my customized link appearance and behavior which is registered to my view by using the NewLinkClass property.



How do I convince the routing tool from demo1 to create links based on my LinkPrototpye and not ordinary GoLinks? [/quote]



It got a bit closer to this one. The tool adapted from demo1 calls the view.CreateLink() method during operation which returns a correct LinkPrototype object since it honors the NewLinkClass property. But it does not raise the view.LinkCreated() event after finishing, which I listen to in order to assign e.g. an UserObject. How can I make the tool call the LinkCreated() event after doing its job?



Still no idea for the two other problems … :(



Thanks.



Regards,

Henning