Question about AutoLayout

We are evaluating your controls an I have a question. We are trying to use your control as a layout control. We are dragging and dropping polygon images into the GoView (this is working correctly). What we are interested in is having them autolayout in a first in is on the left and last in is on the right.

In this example, a polygon is added to the first goView control and is placed at 0,0. I know this happens because the first point of all of the polygons are 0,0.
When I add the second polygon:
It puts it at 0,0 as well. I was hoping that the autolayout would define some rules that would allow for no overlap and automatically move the second polygon to the right 100px to sit next to the first.
Is this possible? Or do we have to write custom code to manage the location of the polygons within the GoView?
Thanks for your time.
Dootndo2

It’s pretty easy to write such a method. This is written as a GoDocument.Changed event handler that checks for whether a GoObject has been added or removed from a layer:

public void LayoutItems(GoDocument doc, GoChangedEventArgs e) {
if (e.Hint != GoLayer.InsertedObject && e.Hint != GoLayer.RemovedObject) return;
float spacing = 2;
float x = 0;
foreach (GoObject item in doc) {
item.Left = x;
x += item.Width + spacing;
}
}
Then you can register the GoDocument.Changed event handler:
goView1.Document.Changed += new GoChangedEventHandler(LayoutItems);
Caution: I haven't actually tried this code; pardon any typos.

Thank you for your prompt response.

I have implemented a similar method with a Windows panel in previous projects.
I am more interested in implementing an automatic layout with rules. Since the objects that we will be adding are generally polygons, we will need to also rotate the objects in order to maximize the number of objects in the panel.
If I were to inherit from the current shipped layouts, would I need to create a reorder method as you described to take advantage of this functionality, or is there a default Layout() method that we can use to take advantage of the great functionality you have supplied?
Thanks again.
dootndo2

There isn’t any default method that rearranges all GoObjects in a GoDocument. You do need to implement a method, as LayoutItems did, above.