override of the method attachField

Hi all, I have another question for the community:
I’ve created a form with a lot of fields, and I want to put them in a layout with three fields for each row. When I do the override of the method attachField(Object propertyId, Field field), the framework puts the labels above the fields (used to insert data), rather than put them correctly at the left. How can I do to solve this problem? Can anybody help me?

The position of the component captions is managed by the containing layout. Most layouts, except FormLayout, place the caption above the component.

With CssLayout, you can make a
CSS trick
to have the caption on the same row, although that solution has a problem that the components and captions will wrap when they reach the width of the row.

You could also use CustomLayout, as is done in
this example

You can do a lot of stuff in the attachField(). For example, if you use GridLayout, you could read the component caption, add it as a Label in the layout, and then clear the caption and add the component in the next cell. You could also wrap each field inside a FormLayout.