Hullo Walter,
I need to create links to display in a document based on data in a database. I get to generate a unique partID for the link, then figure out the from and to ports based on nodes (their partID’s) already on the document. However, using Linkslayer.add(graphlink) does not show the links.
I have tried unloading and reloading the Graphview to no avail.
All the samples get links added diagramatically, my problem is adding links programmatically to nodes that were addes diagrammatically.
Rainbirdit
Did you check to make sure the IGoLink.FromPort and .ToPort are actually set to non-Nothing values? Unless there are ports for a link, there’s no way for GoLink.CalculateStroke() to be able to figure out what the points of the stroke should be.
I did check this and the points are there. I have tried creating a new linkslayer - does not work. I have tried setting the allowview = true to no avail either.
Rainbirdit
I assume you meant “ports”, not “points”.
Creating a link programmatically is just:
GoLink link = new GoLink();
link.FromPort = … find appropriate port …;
link.ToPort = … find appropriate port …;
aDocument.LinksLayer.Add(link);
You can see this code (or a simple variation) in many of the sample applications.