Problems with GoBoxNode port

Hi! I’m relatively new to using Northwoods Go, and I have a simple question regarding ports:

I’m using a GoBoxNode that contains a GoImage, GoText and some collapsible GoGroups. In order for me to link the two nodes, I need to mouse over the port edge, which is really thin. I’d like the GoBoxNode to have the port similar to the one of GoIconicNode - it spreads throughout the whole object, enveloping all subnodes, so if the user activates linking mode, he can click anywhere on the node to start dragging a link, not just at the very edge.


GoBoxNode puts the GoBoxPort behind all the shapes… and then adds PortBorderMargin to it’s size. So… you can increase
PortBorderMargin to get a bigger “new link” hot spot.

now you could play games with moving the GoBoxPort in front of “Body”… but then you’d lose the ability to drag the node unless another object that wasn’t part of Body but was in front of the port.

Could you please elaborate? How do I move GoBoxPort in front of the body element? Is there a Z-order that I can adjust?

As I mentioned before, I want to achieve the functionality similar to the one of GoIconicNode. It can be dragged by clicking and dragging the icon, and it can also be linked by entering linking mode and click-dragging on the same icon.

GoIconicNode always supports linking like that, although in IconicApp, note that it sets the Bounds of the Port to be the same as the Icon. What the “Linking Mode” checkbox does in that app is toggle GoView.AllowLinking. (If AllowLinking is false, then you can also drag the node by the icon.)

so… that approach should work.

You need to change the Port’s brush to null.

  this.Port.Brush = null;

and… you need to add this to your node’s LayoutChildren

 if (this.Body == null) return;
 if (this[0] != this.Body) InsertBefore(null, this.Body);

(I’ve tested this with InfoNode in NodeLinkDemo. You can toggle AllowLinking in the Property Sheet by picking View from the combo box at the top.)

This works for linking, but it seems to prevent me from clicking on expand/collapse buttons in GoGroups within the GoBoxNode. I can see why - the port is capturing the click and not letting it get cascaded down to those buttons. I tried setting Port.Selectable = false, hoping that it would allow the clicks to cascade down, but it didn’t help.

Is there a way to make the port take up the shape of the whole node for linking purposes, yet allow clicks to go through to subnodes of GoBoxNode?

Well… argh. You might be able to override ContainsPoint in your GoBoxPort subclass and selectively return false if something below it wants a click.

I’m not entirely sure I’m giving you good advice here.