View Full Version : HorizontalLayoutContainer and VerticalLayoutContainer absolute positioning

16 Jun 2014, 1:13 AM
I see that both HorizontalLayoutContainer and VerticalLayoutContainer are set to be positionable in their constructor. This makes these containers override settings received from their parent container. For example, I use a CssFloatLayoutContainer with several HorizontalLayoutContainers, where the size of these inner containers are known. I want these inner containers to be positioned below eachother, but the relative positioning set by the CssFloatLayoutContainer are overriden by the HorizontalLayoutContainer element style set in the constructor. The result is that all these inner containers overlap eachother.

Is this intentional, and am I using these containers wrong?

Colin Alworth
17 Jun 2014, 11:00 AM
There is no specific reason you *can't* put HLC/VLCs inside of a CssFloatLC, though I'd question the use case (and probably agree with you once you made your case, though I might suggest an alternative as well). I'll investigate this as part of EXTGWT-3727, which is the CssFloatLC margin issue.

CssFloatLC, by design, does not assign a height. HLC/VLC require a height (also requires a width, but it is at least *possible* for CssFloatLC to assign a width). This means that you need to assign a height (and optionally a width, depending on how the CssFloat data is set up) to the HLC, in addition to any layout data that will be used. If the goal is to get the HLCs to float around each other, this is probably the cleanest way to do it, otherwise I'd look into nesting in a VLC instead (but again, asking the VLC to assign a height), or consider HBoxLC or GWT's HorizontalPanel if you want the children to decide their own sizes.

17 Jun 2014, 10:05 PM
You are absolutely right. I'm using only the width from CssFloatLayoutContainer with CssFloatData size=1. When laying out the HorizontalLayoutContainer, I set the height manually. I managed to get this working with the current codebase using a custom appearance for CssFloatLayoutContainer where I've added "position: relative;" to the child class.

17 Jun 2014, 10:08 PM
I should also point out that I needed more detailed control over how wide each column in the horizontal layout should be, and this is not supported in nether HBoxLayoutContainer nor HorizontalPanel.