Getting GoIconicNode to expand with text lable


I have an application that uses 4 port (top, bottom, left, right) GraphNode / GoTextNode nodes that have text labels “inside” the node images. The whole node grows to accommodate the text inside the label.

My challenge is that I need to add a node that supports up to 15 ports. I chose the GoIconicNode and it meets all my needs, except that I can’t get it to fit in visually with the others. I have the node and it has a little icon with ports around it and an expanding text label underneath it. Is there any way to have the text label inside the boundary of the GoIconicNode and have the whole thing grow with the text label?


GoTextNode has 4 distinct port objects. GoIconicNode has 1. So… I’m assuming you haven’t really added 14 more ports to a GoIconicNode, you’re just allowing a lot of links to connect to that one port.

Right? You might find that a node based on GoBoxNode might be a better choice then. There’s several samples in NodeLinkDemo.


Sorry, I guess I should have mentioned that I did add ports around the perimiter of a MultiPortNode which extends the GoIconicNode. I added the ports using a this.AddPort()...I thought I had done my research before I posted the question I had borrowed the MultiNodePort from one of the demos.

Can you post a screenshot of what you’ve got? (use that “full reply editor” button )


Sorry for the extended delay -- I was enjoying a week away from it all. Here's a screenshot that shows an example of the sort of shape I'm trying to emulate...except with a lot more ports, along with an example of what I was actually able to create...

Well, I don’t see the ports, which is what I was hoping for… to see the positioning of the extra ports you’ve added.

Have you looked at GoGeneralNode? It supports adding distinct input and output ports.

Here are the GoGeneralNode samples in NodeLinkDemo:


I had considered that type of node, but the users are used to ports being input AND output on most objects. I was also concerned that it would have a similar problem regarding the text and icon/image sizing. The tool that was created is a workflow tool to help troubleshoot customer problems -- the flowchart that is created is exported to XML and imported into a database for a custom web site to generate a Q&A tool. The long text in the node is the "question" that's asked to the customers, and the text labels on the connectors are the possible answers.
Here's an example of the port placement on a 5-port node I had created. The larger port counts just add more ports around the perimiter.
Hopefully this is starting to make a little sense?

OK… I’d grab ColoredNode out of NodeLinkDemo, and use the way it does LayoutChildren to put MidLabel in the middle of the node.

Now… you’re going to want to also use LayoutChildren to layout the ports. I’d just use GoGeneralNode’s LeftPorts. You can set port.IsValidFrom and IsValidTo to true to allow input/output ports.

See InfoNode8 for a sample of iterating the LeftPorts in LayoutChildren.

I sent you some starter code…


This was exactly what I needed -- I've got it integrated into my app and the save/export routines work good and I can add ports that I need, etc. I think there's just one last thing I need help with:
The LabeldLinks all go DOWN (the ones on the sides try to go ALL THE WAY down the shape) before they go to the node they are connected to. Is there a property I'm missing on the ports, or is there something I need to override to make the GoLabeledLink point straight away from the node?
I don't seem to have this problem on the GraphNode, just on the new one.
public override IGoLink CreateLink(IGoPort from, IGoPort to) { IGoLink il = base.CreateLink(from, to); if (il != null) { GoLabeledLink l = il.GoObject as GoLabeledLink; if (l != null) { string g = from.Node.GetType().ToString();
if (g == "FlowCharter.GraphNode") { GraphNode fromNode = from.Node.GoObject as GraphNode; if (fromNode != null && ((fromNode.Kind == GraphNodeKind.DecisionCustomer) | (fromNode.Kind == GraphNodeKind.DecisionCSR) | (fromNode.Kind == GraphNodeKind.DecisionSystem))) { GoText t = new GoText(); t.Text = "yes"; t.Selectable = false; t.Editable = true; l.FromLabel = t; } }
else if (g == "FlowCharter.CircularGeneralNode") { CircularGeneralNode fromNode = from.Node.GoObject as CircularGeneralNode; if (fromNode != null) { GoText t = new GoText(); t.Text = "yes"; t.Selectable = true; t.Editable = true; l.FromLabel = t; l.FromLabelCentered = true; l.MidLabel = t; l.MidLabelCentered = true; } } l.Orthogonal = true; l.Style = GoStrokeStyle.RoundedLine; l.ToArrow = true; } } return il; }
I've tried different GoStrokeStyle options, but they all do the same thing, go DOWN before they head to the node.
Thanks for all your help!

You want to set the individual port’s FromSpot/ToSpot. It looks like you have FromSpot to be MiddleBottom now.

for example, for a port on the left, you’d set FromSpot and ToSpot to MiddleLeft.

That was exactly what I needed. Thanks again for all your help!