GoPort label and connection point

Any advice, or pointers to an example for:

  1. Adding a label to a movable GoPort?
  2. If the port is moved from a side-to-bottom, can the connection direction for a link be adjusted to connect from the bottom of the moved port? Or side-to-top? Or side-to-the-other-side? You get the point.
Thanks.

Yes, you can do all that… but maybe we should start with a question about what kind of diagram you’re trying to implement… if you can provide an example, that’s a big help.

I intend to build a node similar to the info8 example, one with 3 input (top, left, bottom) nodes, and 7 very specific output nodes. I want the user to be able to rearrange the position of the output ports, so from the little I have learned thus far, I will need to use the moveable GoPorts.

OK…

  1. ports don’t have a built in notion of labels. That’s something nodes like GoGeneralNode add.
  2. set the FromSpot/ToSpot to set the direction links connect to nodes.

e.g. for an input port on the left side:

      p.ToSpot = MiddleLeft;

for an output port on the right side:
p.FromSpot = MiddleRight;

GoGeneralNode is one place to start, with LeftPorts being the inputs and RightPorts being the outputs. But you’d have to completely override LayoutChildren to take over control of the positioning of ports and their labels.

The other choice would be ActivityNode in the Processor sample, where the draggable ports magic is already there, but you’d have to add the support for labels.

It’s not clear if you want the movable ports able to move completely freely (like Activitynode) or with some constraints (like snapping to one of 3 fixed spots on the top, for example).

And do you want the labels to rotate based on position? or just stay horizontal?

This is probably easier to pull off in GoXam, there’s better geometry management there.

Thanks. I will look at your suggestions.