Change the default behavior of a port

we like to change the default behavior of ports like…

  • If the user click on a port, the port is changed its position.
    - The linking from port to port is calling from a context menu item
    I have already implement a port moving tool like your example and it works fine.
    But now I am searching for the right place to insert the three tools (PortMovingTool, ToolRelinking, ToolLinkingNew).
    I try to Replace the MouseTool in the view… but your default behavior is shown (the port want to link to another port).
    Can you help me please?

If you only want users to draw new links when they invoke a command (such as from a context menu item), then you don’t want users to start the GoToolLinkingNew tool modelessly and you want to start that tool from your code.
You can achieve the former by removing that tool from the list of the GoView’s mouse tools:
goView1.ReplaceMouseTool(typeof(GoToolLinkingNew), null);
To start a linking operation programmatically, do something like:
GoToolLinkingNew tool = new GoToolLinkingNew(goView1);
tool.OriginalStartPort = theCurrentPort;
goView1.Tool = tool;
This is demonstrated in commented-out code in the LimitedNode example class of Demo1.

A post was split to a new topic: Changing mouse movement from drag to draw a new link