suzi167
December 17, 2007, 2:07pm
1
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.
Jake
December 17, 2007, 2:26pm
2
"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?
Jake
December 17, 2007, 2:29pm
3
Suzi167, can you update the email in your profile to something we can associate with a company?
suzi167
December 17, 2007, 2:37pm
4
Hello,
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?
Thanks
Susan
Jake
December 17, 2007, 2:45pm
5
you have to click the “Post Reply” button to get the full editor… the Quick Reply box doesn’t allow uploading pictures.
suzi167
December 17, 2007, 2:51pm
6
By the way - just to add - I am calling the method above from the
void methodBuilderView1_
MouseCaptureChanged (object sender, EventArgs e)
{
UpdateLayout();
}
event
suzi167
December 17, 2007, 3:06pm
8
The first image is before I collapse and Expand the Extendible Node and the second one is after I collapse and expand it.
Susan
suzi167
December 17, 2007, 3:07pm
9
Just to clarify…in this case we have subgraph ( step 1 and Step 2) whithing another subgraph(Activate)
Jake
December 17, 2007, 3:55pm
10
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.
suzi167
December 17, 2007, 4:24pm
11
Thanks Jake,
I willi try your suggestion
Susan