Tuesday, November 29, 2011

Re: GWT 2.0.4 Way to query browser window's document area size in onModuleLoad

Hi,
The post is a little old but I would just like to share a solution.
In my onModuleLoad() method of the "main" class in my GWT project the first thing I do is setting the height of the rootPanel to 100%.

RootPanel.get().setHeight("100%");

From here I can then work with the rootPanel object to obtain the offSetHeight which can then be used to set the height of my other panels.

I have a menuBar which is a horizontalPanel and the height is 60px. Below the menu bar I have a flowPanel and I set the height by obtaining the rootPanel height - 60px. I fill this flowPanel with a Map where the Width and Height is set to100%.

FlowPanel mapPanel = new FlowPanel();
int height = RootPanel.get().getOffsetHeight() - 60;
mapPanel.setHeight((new Integer(height)).toString());
mapPanel.add(Map.getMap());

Hope this helps.

Cheers,

Dennis

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/ftj_LKCk8WAJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment