Custom GoObjects linking


We're using a derivative of the ClassDiagramNode from Demo1 in our application. Everything is working great with it, except for one minor issue.
We have a mode in our application that allows drawing links between these nodes. However, when drawing links, the user must ensure that the point at which they try to begin drawing is not occupied by any of the labels. If they do not, they will end up getting an arrow cursor rather than a hand cursor, dragging the node instead of initiating the linking GoTool.
I'd like for the size of the port to cover the entire node, ignoring the text labels. Is there an easy way to do this?
Thanks, Tyler

ClassDiagramNode inherits from GoBoxNode, which has the Port behind the Body, so that mouse events will go only go to the Port when they are not intercepted by GoObjects in the Body.

So one possibility is to change the Z-order of the Port and the Body. Here's how you can put the Port in front of everything else in the node:
[code] node.InsertAfter(null, node.Port);[/code]

Ah, Ok. That works. I should note that in order to get control of the text boxes again, I’ll have to call

node.InsertBefore(null, node.Port)
so that the fields get mouse events again.
Thanks Walter :)

Well, you don’t even have to do that if you have two modes – one allowing linking, and another that doesn’t allow linking.

That can be controlled by setting GoView.AllowLink.

Hmm, I tried setting GoView.AllowLink to false and it looks like the GoBoxPort is still preventing me from editing the text in the nodes.


Oh, well, if you want those GoText objects to respond to clicks, you’ll need to change the Port’s Z-order after all.