Hi,
I would like to ask you how to use FormLayout correctly. I have simple View with outer panel with outer layout (FormLayout), and inner panel with inner layout (HorizontalLayout). I would like to have outer panel, outer layout and inner panel independent width to inner content. Now when I put “big” content to the inner layout, then innerPanel and outerLayout fit to contents size. It’s is not what I expected. I would like to see scrollbars on innerPanel.
When I tried to replace FormLayout by VerticalLayout it works well. Any idea?
Thank you, Michal
Label formLabel = new Label("some text label xxx");
Label formLabel2 = new Label("some text label xxx");
HorizontalLayout horizontalLayout = new HorizontalLayout();
horizontalLayout.addComponent(formLabel);
horizontalLayout.addComponent(formLabel2);
// scrolling panel if conent is wider
Panel innerPanel = new Panel("Inner panel");
innerPanel.setContent(horizontalLayout);
// variant NOT ok - when innerPanel content is wider than innerPanel, innerPanel fit the content size
// and is wider than outerPanel
FormLayout outerLayout = new FormLayout();
outerLayout.addComponent(innerPanel);
// variant Ok - when innerPanel content is wider than innerPanel scrollbar appears
// VerticalLayout outerLayout = new VerticalLayout();
// outerLayout.addComponent(innerPanel);
Panel outerPanel = new Panel("Outer panel");
outerPanel.setWidth("200px");
outerPanel.setContent(outerLayout);
addComponent(outerPanel);