GoRectangle


#1

If I have my own class that inherits from GoRectangle and I want a GoText property to be part of my class and be displayed inside the rectancle, how do I do this?
I want to declare something similar to a GoSimpleNode but with added features.
I assume I must declare the properties and then on the Rectangle’s paint event redraw all the other objects?


#2

Well, you can certainly define a subclass of GoRectangle that has its own String property. But if you want to have a GoText object, you’ll need to use a GoGroup that contains both a GoRectangle and a GoText object.
If you want something similar to GoSimpleNode, just inherit from that. A good example of adding child objects in a subclass of an existing node class is provided by the SequencedNode class in Demo1.


#3

I now have two objects in a goGroup. If I want the whole group to be resized as if they are one, how do I do this? Moving is working.


#4

Programmatically, you can resize it just by setting the group’s Size property; the children are automatically rescaled and repositioned appropriately by GoGroup.RescaleChildren followed by GoGroup.LayoutChildren.
Interactively, I will guess that your problem is that the user can’t seem to select the group as a whole because when they click on a child, the child is being selected. So make sure each child of the group is not Selectable.


#5

I am still having difficulty to get this right. All I want to do is to inherit from GoNode, create my own shapes (GoRectangle, GoTriangle, GoText) and then to have the GoText center aligned at all times, even when the user resizes only in the y-coordinates.
Can someone please post some example code of how to do this. I have tried numerous things now, but cannot get the resizing in the y-coordinates to have the GoText automatically re-center itself. It works if the x-coordinate changes, but only if I reset the WrappingWidth myself.
Any help would be great, thanx.


#6

I guess I don’t understand exactly how you want the node to look. Could you just use a GoBasicNode, where you have the LabelSpot be GoObject.Middle? Or maybe you could just use a GoTextNode, just as the FlowCharter example does?