Layout Issues

I am having to do my own custom layout. I need to layout “network” nodes in some specific ways. Here is an example of one (picture below). In this, I am trying to do a “balanced” (right/left) layout. The algorithm I am using is basically:

  1. Center middle/root node
  2. Define the right and left sub-boxes.
    3 For each side (right/left):
    a. Calculate the relative weight widths of each node horizontal slice (a slice is the next node sets to be layed out vertically together).
    b. recursively go through each slice and determine the width for the slice box; calculate the vertical sub slices (if more than one object per slice); and then center each slice node in a sub box defined by weighted slicing horizontally and vertically.

What I am seeing is that it seems:

  1. The middle/root node is not being centered correctly. I have checked the math and debugged it and the coordinates that are being set are “centered” based on the view component they are contained in.

  2. The right and left “slices” of nodes seem to be centering above the root, which is even more disturbing.

Questions:

  1. Is there some silent adjustments that are taking place behind the scenes after I do my manual layout? If so what are they?

  2. Does anyone know why if a view container bounds are used to center the root node, why it would end up low and to the right?

Here is the picture.

<wow it won’t let me add the picture>

You can insert pictures if you click the “post reply” button at the bottom (down by “new topic”).

1. Is there some silent adjustments that are taking place behind the scenes after I do my manual layout? If so what are they?

-- no, Nodes should go where you put them.
2. Does anyone know why if a view container bounds are used to center the root node, why it would end up low and to the right?
-- SetSpotLocation is (in my opinion) a better way to move things. It gives you explicit control over where you want the spot (topleft, middle, etc).

Thanks…

On answer (2)…

I am setting the root node (center node for a balanced right/left layout) to be the center of the current size of the view. I do not understand your response regarding SetSpotLocation.

I think I read that wrong. You’re trying to center the objects within the view?

this note may help then: http://www.nwoods.com/forum/forum_posts.asp?TID=2303&KW=center

Question… I think I just figured out why…

I am still using the evaluation compiler that puts the “GoWin Diagram, for evaluation…” text up in the top left corner. Would that force the diagram to move down and right, and not be centered? I just read the link you sent me and basically changed the things it suggested and it is still down and right of center.

What value do you have for GoView.SheetStyle ?
Try setting GoView.SheetStyle = GoViewSheetStyle.Sheet. This tells the GoView
that it should allow scrolling beyond the GoDocument.Bounds.

Not my question… I am asking if the inclusion of the eval text is the culprit for moving my “center” down and to the right?

No, the watermark has no effect on any view behavior.

Wierd, because the distance it is offset is almost perfectly the dimensions of the watermark.

To center any document object in a view, it should suffice to do:

goView1.SheetStyle = GoViewSheetStyle.Sheet; // or any non-None value, actually
goView1.DocExtentCenter = someObj.Center;

However, it might not appear to be exactly centered in the painted area of the view because of the presence of scrollbars.

Another consideration is whether you are trying to do this before the GoView has been realized and laid out by the Form. That doesn’t sound like it’s the problem in your case, but you do want to make sure that the GoView has its final size before trying to center anything in it.