Free drawing of links

I would like to be able to “free” draw links between nodes. By this I mean the following: clicking a port starts a link, move the mouse in the view, click again and create a spot where the link connects, move the mouse to the destination port click again and connect.

Basically I don’t want the “autorouting” but define the route of a link myself.

I’m new to GoDiagram and don’t know if this is possible. If possible could you guys please point me in the right direction.

Thanks in advance

Well, I can suggest a couple of ways based on what I just experienced. First off, you can create your own “Link” by subclassing GoStroke. A go stroke just defines a point to point line, that is drawn. If your links are going to have multiple segments, that may be a lot of work. The other way, you might consider is subclassing an existing link class you like and doing some overrides on the layout.

Just a couple of suggestions.

Whenever one is talking about modifying behavior dealing with input events, especially mouse-down-move-up, one needs to deal with tools.

Sometimes changing the behavior is simple: set some property on either GoView or the particular tool to get what you want. Examples that happen to involve drawing links include GoView.AllowLink, GoView.PortGravity, and GoToolLinking.ForwardsOnly.

Also, completely disabling the behavior might best be done by removing the tool from the view, by calling GoView.ReplaceMouseTool with a second argument that is null/Nothing.

But for more complicated customization, you need to either override some methods of an existing tool, or you need to define your own tool.

As it so happens, what you are asking for is already implemented in the Demo1 sample. Try using the RoutingLinkTool. You can invoke it from the Edit menu. That tool assumes the user wants to draw orthogonal links, but that need not be the case.

Thanks, the behavior of the RoutingLinkTool is pretty much what I’m looking for. I’ll look in to that.

i am the starter i dont know how use entire thing can any one suggest me a way to cope up with this…

Start by reading the WinIntro and/or WebIntro documents, then the User Guide. After that, it’s a good idea to find a sample or two that are close to what you want to do, and read the code to understand how they work. Most of our samples are a fairly small number of lines of code.