PDA

View Full Version : setAutoWidth for Window doesn't work



thequest
10 Nov 2009, 1:23 PM
This occurs both on FF2 and IE6.



this.popup = new Window();
this.popup.setAutoHeight(true);
this.popup.setAutoWidth(true);
this.popup.setHeading("Test");
this.popup.add(new Label("Just some widget..."));


When this Window is shown, if this.popup.setAutoWidth() is called, then the width will be such that the the Window is as wide as the browser (and the bottom of the Window doesn't exist when I run it in GWT hosted on XP). If this.popup.setAutoWidth() isn't used, then the Window will be the default width of 300px.

Has anybody seen this issue or found a workaround? According to the specs, GXT is supposed to support both these browsers...

Stephen

sven
12 Nov 2009, 5:24 AM
This is a browser problem. As it is a floating component browser auto width cannot work. YOu will need to define a size, also note that you should always define a size.

thequest
12 Nov 2009, 8:51 AM
Followup questions:

Why is it that setAutoHeight works fine while setAutoWidth does not?

And why do you suggest to always set the width? In my case, I have a window that contains a dynamically populated table which might be any number of rows high and columns wide. Shouldn't there be a way to dynamically size the parent component based on the contents?

Thanks,

Stephen

sven
12 Nov 2009, 11:09 AM
Why is it that setAutoHeight works fine while setAutoWidth does not?

This is how browsers work. And as they even work different from browser to browser when using auto sizing, you should never ever do it.