GoLayoutLayeredDigraph issue

I have the following code:

private void LayoutChildren(ExtendibleNodeCollection sg) {
GoLayoutLayeredDigraph layout = new GoLayoutLayeredDigraph();
layout.Document = this.methodBuilderView1.Document; layout.Network = layout.CreateNetwork(); layout.Network.AddNodesAndLinksFromCollection(sg, true); foreach (GoObject node in sg) { ExtendibleNodeCollection nodeCollection = node as ExtendibleNodeCollection; if (nodeCollection != null) LayoutChildren(nodeCollection); } layout.DirectionOption = GoLayoutDirection.Down; layout.PackOption = GoLayoutLayeredDigraphPack.Straighten; layout.LayerSpacing = 15; layout.PerformLayout(); layout.LayoutNodesAndLinks(); foreach (GoObject obj in sg) { GoLink link = obj as GoLink; if (link != null) link.CalculateStroke(); }


I call this method each time I collapse and expand an ExtendibleNodeCollection node.
I don't always get it to lay out the child nodes correctly.
What am I doing wrong.
"I don't always get..." do you mean that no layout happens, or that you get layout, but it isn't what you expected?
Can you provide screenshots of what you get and what you want?

Suzi167, can you update the email in your profile to something we can associate with a company?

I changed my e-mail in the profile.
I can not attach any files to a post.
Do u have an e-mail where I can send you the screen shots?

you have to click the “Post Reply” button to get the full editor… the Quick Reply box doesn’t allow uploading pictures.

By the way - just to add - I am calling the method above from the

void methodBuilderView1_MouseCaptureChanged(object sender, EventArgs e) { UpdateLayout(); }


The first image is before I collapse and Expand the Extendible Node and the second one is after I collapse and expand it.


Just to clarify…in this case we have subgraph ( step 1 and Step 2) whithing another subgraph(Activate)

MouseCaptureChanged probably isn’t the best place to add this feature.
Let me suggest you override GoSubGraph.FinishExpand, and do the Layout call from there.

Thanks Jake,

I willi try your suggestion