Vertical Layout div problem

Hi ,

I am using a vertical layout and i set the width of the layout to browser width. for ex: 1280.

I also set the margin to false. But the problem i am facing right now is that the default div of the vertical layout is not taking full size of the vertical layout.

My code :

VerticalLayout root = null;

((VerticalLayout) application.getMainWindow().getContent()).setMargin(false);
((VerticalLayout) application.getMainWindow().getContent()).setWidth(application.getBrowserWidth(),Sizeable.UNITS_PIXELS);
root = (VerticalLayout) application.getMainWindow().getContent();
root.setWidth(application.getBrowserWidth(),Sizeable.UNITS_PIXELS);
root.setMargin(false);

In browser

One more thing is that when i refresh the page the size gets full. but on first launch its not working fine.
please give some inputs for the problem.

Thanks in Advance

Regards
Tarun sawlani

The browser width information is not yet available in the init() method of the application, but only after the first request after that. Therefore, you should never rely on that. You should generally try to use the relative sizes for layouts, such as “100%”, or assume some reasonably small fixed widths, such as 800px.

In TouchKit, you can get the browser width in [tt]
onBrowserDetailsReady()
[/tt] method.

… or you can set up the layout contents on attach by overriding MyComponent.attach() and doing your own processing after calling super.attach().

Thanks for your sugesstion. But thats not my problem.
I am getting the brower width but at intial lauch. I always need to refresh my page .

I am using a vertical layout which is using that browser width. but the default div inside the layout is not taking the full size.
How ever we cant set the size of default div by writing code.
Is there any way to do that.
Or can you please tell me any work around for the same.

Regards
Tarun

I am using a vertical layout which is using that browser width. but the default div inside the layout is not taking the full size.
How ever we cant set the size of default div by writing code.

[/quote]

With Vaadin layouts, you should never need to try to adjust e.g. the size of an internal div of a layout “by hand”, nor will you be able to. Very, very few applications need to know the screen or window size anyway, except sometimes to choose alternative layout structures for very small displays.

I would recommend that you try with relative sizes (“100%” for the main layout, at least), open the debug console (add “?debug” to the URL) and click “Analyze layouts”. It might find problems with the compatibility of the different size settings in your layout hierarchy. If not, the problem is still very likely in the size settings of your layouts and can be solved with mostly relative or “undefined” sizes (or fixed sizes in pixels for specific sub-components only) without knowing the size of the window.