Change From,To Link direction at runtime

Hi There ,
I want to make the user freely select From and To Link direction at run time , [one of 4 choices (Left,Right,Top,Bottom) as I use orthogonal link]…
What I did … override GetToLinkDir and GetFromLinkDir in MyPortClass to do this logic based on user selection … I called this 2 functions in the set of the Direction Property in MyLinkClass
myLink.FromPort.GetFromLinkDir (myLink)
and
myLink.To.GetToLinkDir (myLink) …

The problem is that the link need to be redraw or the port itself should refresh its links … as work around for that I move MyLinkNodes for a new location and return them to original locations again as a way for refresh link …What I am asking is there is any Straight Forward way to do so…or better idea implement my above requirement
Thanks for your kind cooperation

GoLink.CalculateStroke() is responsible for determine the points in the stroke path.
If you have a GoBoxPort, you can call CalculateStroke on each of the links connected at that port.

Thanks a lot … That works fine

Hello, as much as I’ve tried the above behaviour is exactly what I am
after but I am toiling on the implementation. My scenario is this :

using Go Win 2.4 beta

I wish to via a context menu allow a user to specify a links’
destination direction. I.e. the user has moved a node and the direction
is no longer appropriate - so a menu of (top, left, bottom, right).

I am using an overriden GoLabeledLink with orthogonal style linkage and the adjustingstyle of End.

I have implemented the menu and the eventhandlers which is fine. The
problem I have is how I dynamically adjust the links ‘to’ direction.

The odd thing is that if I create a blank overriden port class for my
node by overriding CreatePort all my inputs always go the left port
side. So overriding GetToLinkDir was not going anywhere - I took the
simplistic approach of adding a property ‘Direction’ to the port which
I assign in the eventhandler for the link menuitem then call
CalculateStroke. GetToLinkDir checks this value if set, to override the
direction.

In addition because GoLabelledLink contains a GoLink and hence doesnt
derive from it, consequently I cant stick an override in here for
GoLink and when I try adding my own overriden class and assigning it to
the RealLink property I still dont get expected behaviour.

Sorry if this is sounding a bit confused but I’ve been trying to get
this working and have tried a few approaches that I’m sure have
confused the issue.

My node is an overriden GoBasicNode, I tried GoTextNode but this will
probably confuse the clients as I would have to check that there can
only be one link between the same nodes and they will be moving nodes
around the place - so will definitely be wishing to have a smarter link.

Much appreciated if you can help.

Actually, the GoPort.ToSpot (or for the other end of links, the GoPort.FromSpot) controls the point and direction for the “to” ends of links at a GoPort. When the ToSpot is GoObject.NoSpot, then it gets more complicated because the point and direction are computed based on the link.
Note that all of these GoPort properties and methods control how all links connect to that port. Did you want to customize the behavior for an individual link, and not for all links at a port?

Correct I wish to modify the behaviour for an individual link.

“Note that all of these GoPort properties and methods control how all links connect to that port”

Nod, thats why I added the property Direction to the overriden class so
I can perform the behaviour on a per instance basis. Assuming each Node
has its own instance of GoPort.

Edit: ah might have misunderstood you. Sorry if confused you are saying
that if two links are coming in then the port methods will be the same
for both. Hmm would that mean I need to have the direction property
added to the link and not the port.

Well, the AdjustableConnectionLink example in Demo1 might do something like what you want, although I suspect it’s rather more featured than you need.
We ought to add this kind of functionality into GoDiagram sometime, if we can figure out what most people would want without breaking/inconveniencing anyone. What you are asking for isn’t requested too often, though.

Great ta, I think I can grab what I need from that.