GoSubGraph handle


#1

Looking at the 2.2 beta, the GoSubGraph handle has a child object which is called Handle, which is denoted by a small rectangle with a +/- or o on it, to allow the user collapse/expand the node by clicking it. This is a GoSubGraphHandle object, which behaves diffenetly from other objects you add to the GoSubGraph. it stays in its spot, always on top, and defines a top-margin which other childs cannot pass.
My Question is, how can i achieve such a behaviour from a GoSubGraph child (even a specific one i create for specific purposes by code)?
thanks,
Adi


#2

If you want to always display a particular child object at a certain spot, you can implement this by overriding several methods: LayoutChildren and ComputeBoundsSkip. You may also need to override other methods, such as ComputeCollapsedSizeSkip.
Overriding LayoutChildren is the standard thing to do whenever you want to position and/or size a child of a group. You’ll want to have ComputeBoundsSkip return true for your special child, so that it doesn’t take part in the normal bounds calculations, which would result in the regular behavior: always stretching the subgraph to include its children.
The MultiPortSubGraph example class in the SubGraphApp sample does this, because it wants to position the additional subgraph ports along the sides, and it because it wants to do so even when the subgraph is collapsed.