PDA

View Full Version : Window sizing



ClemsonJeeper
11 Sep 2008, 10:40 AM
Silly question I'm sure but if I am using a Viewport as my main interface, how can I create a popup window that is based on the size of the browser? EG: I want it to take up 80% height, 80% width initially.

Possible?

TIA

zhegwood
11 Sep 2008, 10:59 AM
thiswidth = eval(Math.floor(Ext.get(document.body).getWidth()*.8));
thisheight = eval(Math.floor(Ext.get(document.body).getHeight()*.8));

thiswindow = new Ext.Window({
width: thiswidth,
height: thisheight
});

ClemsonJeeper
11 Sep 2008, 11:03 AM
The height calculation doesn't seem to work.

Ext.get(document.body).getHeight() returns 80...

Probably because I have my header <div> in flat HTML, and then the Viewport includes it in the right location when it renders itself....


I suppose I can just use window.innerHeight. I wasn't sure if there was an Exty way to do it.

devnull
11 Sep 2008, 11:09 AM
why not just use 80% of document.height and document.width?

ClemsonJeeper
11 Sep 2008, 12:26 PM
Yes, that would work too. Like I said I wasn't sure if there was an "Ext" way to do this via the framework.

On a side question, how do you make a HTMLEditor object in a form take up the remaining space in a modal Ext.Window? What I am looking to do is exactly like Form #3 in http://www.extjs.com/deploy/dev/examples/form/dynamic.html , but rather than using a fixed height, it will obviously be dynamic since the Window's size will be based on the size of the browser height. Is this possible?

devnull
11 Sep 2008, 12:29 PM
It seems like it should work like that if placed into a fit layout as the only item. Failing that, an anchor layout may work.

zhegwood
11 Sep 2008, 12:30 PM
Maybe give it a layout:"fit" - Not sure if this is possible on the htmlEditor, but you could try on that element and also it's container.

ClemsonJeeper
11 Sep 2008, 12:40 PM
It seems like it should work like that if placed into a fit layout as the only item. Failing that, an anchor layout may work.

The fit layout works, as you said, with it as the only item, but that won't work for me since I need a few text entry form fields above it. Is it possible to put a form layout for a portion of the window and fit for the rest?

I'm still trying to grasp the layout concept obviously. :-)

devnull
11 Sep 2008, 1:02 PM
Well the fit layout can be part of a higher level layout as well, such as a column or a region in a border layout. It sounds like you may want a border layout with a form in the north region and the html editor in a fit layout in the center region.

ClemsonJeeper
11 Sep 2008, 1:24 PM
Well the fit layout can be part of a higher level layout as well, such as a column or a region in a border layout. It sounds like you may want a border layout with a form in the north region and the html editor in a fit layout in the center region.

This along with messing with some of the style is exactly what I was looking for. THANKS!