Stationary GoSubGraph

Hello,

I am a bit new to GoDiagram, so this might be (and hopefully is) a question with a simple answer. I have a GoSubGraph with a rather large font. Whenever I collapse the sub graph, it shifts to make the small yellow collapsing node in the middle of the collapsed graph and label.
Is there a way to keep the top left corner of the graph always on the little yellow square, with both not shifting at all?
Cheers,
Sherban

Well, I’m not sure if this is going to solve the problem, but is this “better”?

this.CollapsedLabelSpot = GoObject.TopLeft;
(start with the easy stuff first)

That did change the location of the yellow square; however, it is now somewhere near the bottom left corner of the node. It is “better”, but the graphs still shift whenever I expand/collapse them.

How about this then? in your SubGraph class…

[code]
public override void LayoutLabel() {
if (this.IsExpanded) {
base.LayoutLabel();
} else {
if (this.Label == null || this.Handle == null) return;
this.Label.SetSpotLocation(TopLeft, this.Handle, TopRight, 2, 0);
}
}
[/code]
This works if LabelSpot = TopLeft (like TreeSubGraph in SubGraphApp)
That worked quite well, thank you very very much
It did, however, make my layout a bit wonky (though, it was never perfect to begin with). Perhaps you could help with that too?
I have GoIconicNodes within SubGraphs within SubGraphs within... . I don't particularly care how they are layed out, as long as none are overlapping, both if they expanded or if they are collapsed.
This is what I'm doing now:
[code]
public void LayoutGraph(IGoCollection col1, GoDocument doc)
{
foreach (GoObject obj in col1)
{
GoSubGraph sg = obj as GoSubGraph;
if (sg != null)
{
bool expanded = sg.IsExpanded;
if (!expanded)
sg.Expand();
LayoutGraph(sg, doc);
if (!expanded)
sg.Collapse();
}
}
GoLayoutForceDirected layout = new GoLayoutForceDirected();
layout.Document = doc;
layout.Network = layout.CreateNetwork();
layout.Network.AddNodesAndLinksFromCollection(col1, true);
layout.PerformLayout();
}
[/code]

Logically this seems like it should work -- I actually believe this code is directly from another solution where sombody had a similar problem. My nodes still overlap one another, though. What am I doing wrong?

Sorry for the delay, my RSS feed seems to have died…

Can you give us a screenshot showing the issue?
This is what I mean:


In this example, the two inner graphs (which are currently collapsed) overlap one another. This overlapping happens inside all of my graphs. Of course I can move the inner graphs so that there is no overlap, but I was wondering if there was a way to make sure they do not overlap at start-up (i.e. without the user having to move them or me having to manually code positions).
Also, two outer graphs can even overlap (though, this only happens after they have been expanded, and only when there are many graphs added to the GoView):

Well, I tried your code in SubGraphApp (that’s where the layout logic comes from, although it was using Layered, not Force Directed layout).

I can't get the overlap, but I'm don't have the collapsed subgraph labels you do...
Try adding this code.... it will help you see what the recursion is doing step by step:
layout.PerformLayout(); // your code
// add this bit
GoSubGraph x = col1 as GoSubGraph;
string label = "root";
if (x != null) label = x.Label.Text;
MessageBox.Show("layout " + label);