Hi,
Hi Adi,
the selection handles are placed on the border of the node or the border of the SelectionObject – which can be configured and is allways part of the node. So i think the node itself is correctly resized.
Nodes are container classes. They can contain any other GoObject (e.g. text and shapes). Have you added any other GoObject to the node? If you have, it is neccessary to override LayoutChildren to tell your node what the additional objects should do when node (aka container) is resized. I would suggest to have a look at demo1 of GoDiagram and search for LayoutChildren.
Maybe the size of a GoTextNode normally is determined by the space the text needs to be displayed. If you set resizable of the node to true, the GoText which holds the text in the GoTextNode is not resized as the node. If this is the case, you can do it with an own implementation of LayoutChildren and perhaps adjusting some properties of the GoText.
Best regards,
Joern
Presumably you want to let users change the size of the node. But the size of the Background rectangle is normally constrained to be the size of the Label, plus the margins.
So you want to set GoTextNode.AutoResizes to false. This will change the behavior of LayoutChildren so that the Label is resized to fit inside the Background, minus the margins.
OK Walter i did it but now im not getting the selection handlers when i select the object and even the overriden addSelectionHandler is not called. is there a way to add the handlers programmatically?
Sorry, I didn’t realize you had customized the selection handles.
When GoTextNode.AutoResizes is false, the SelectionObject is the GoTextNode.Background, not the whole node. So it is the Background object whose AddSelectionHandles method is being called.
So if you want to continue to customize what resize handles are shown, and where, and what they do when dragged (in an override of DoResize), you’ll need to do so on the class that implements your GoTextNode.Background object.
I hope that makes sense to you, because the Background object could be implemented by arbitrarily different kinds of shapes or groups, and one would expect different kinds of resizing behavior for different kinds of shapes or groups.