GoNode repositioning when resize handles clicked

Hello!

When I drop a GoNode onto my display (a GoView), then drag the GoNode to a new location on the GoView, then select the GoNode (revealing the six resize handles), then click on one of the resize handles, the GoNode snaps back to its original position where it was originally placed on the GoView. What is happening here?

My GoNode has several children - one GoImage, one GoText, and 6 GoPorts. I have overridden the DoResize method in order to keep the text centered within the image and to keep the GoPorts in their appropriate spots (TL, TC, TR, BL, BC, BR). I experimented with DoMove,
setting the GoNode.SelectionObject.Location based on the updated location provided by DoMove, but no luck. Any thoughts as to what might be happening?

Thank you very much

You shouldn’t be overriding DoResize in order to layout your node the way you want it to look. That’s the responsibility of the LayoutChildren method.

If you do need an override of DoResize, because you want to do special handling of resize handle dragging, then that method should just modify what it needs to, and let LayoutChildren do the rest. Normally DoResize should just be modifying the size of the object that LayoutChildren is depending on in order to place the sibling children.

Thank you very much. Overriding LayoutChildren did the trick. Now my problem is the layout of the ports. For some reason my math doesn’t work
any longer (or perhaps it never did). I now have 8 ports (i.e., TL, TC, TR, ML, MR, BL, BC, BR). Is there a convenience function for modifying a rectangleF to set these 8 ports? If not, can you point me to code that sets these standard locations for GoPorts? Per your recommendations, I’ll put this GoPort placement code inside of LayoutChildren.

Thoughts?

Thank you again.

RH

I’m not sure what you are asking for. Do you mean GoObject.SetSpotLocation, which is a fancy way to set the Position of a GoObject relative to another GoObject?

Yes,

I did mean SetSpotLocation.

Currently, in LayoutChildren, I call SetSpotLocation on each of the GoPorts
to reposition each GoPort relative to the edges of the GoNode parent. The version of the SetSpotLocation method I’m using has the signature (int, PointF), where the int is the position code and the pointF is the new X,Y location of the spot. Unfortunately, once the parent GoNode resizes the GoPorts end up in positions that are not what I intended.

For example, after the GoNode resizes, my top center GoPort repositions to a point much closer to my top left GoPort, instead of being top and center. My math (to calculate the new pointF) looks right but isn’t, at least during a resize operation. There seems to be a more complicated relationship between the boundaries of the parent GoNode and the positioning of children (GoPorts). Any thoughts as to what I’m doing wrong?

Thank you. You’ve been most helpful

Hello Again,

I’ve fixed my problem by switching to the other version of SetSpotLocation,
the one having a 3 argument signature, (int, GoObject, int). This version keeps the GoPorts properly positioned and spaced.

Thank you.