View Full Version : [fixed] Aligning an Ext.Window

2 Dec 2009, 1:41 AM
I have two windows in my application that both open in a center by default, but I want to align them so that first opens aligned to the left of the screen ant the other to the right of the screen, so that windows are always aligned in a different resolutions. (x/y don't work in this case).

Also is there a way that new window that will be opened, align his upper-left corner in the point (let's say 200px left and up from center of the screen) and every other opened window aligns 20px less than the first (to make that cascading windows look).

2 Dec 2009, 2:04 AM
I found a solution with this: var browserWidth = Ext.lib.Dom.getViewWidth();

And for the other question I did it this way, if someone knows a better one please reply.

var xGlob = 200;
var yGlob = 200;
Ext.ux.Window = Ext.extend(Ext.Window, {

constructor: function(config)
var browserWidth = Ext.lib.Dom.getViewWidth();
var browserHeight = Ext.lib.Dom.getViewHeight();

var x = (browserWidth/2)-xGlob;
var y = (browserHeight/2)-yGlob;

config = Ext.apply({
layout: 'fit',
closable: true,
closeAction: 'hide',
resizable: true,
draggable: true,
x: x,
y: y,
plain: true,
border: false,
show: function()
xGlob = xGlob-20;
yGlob = yGlob-20;
}, config);

Ext.ux.Window.superclass.constructor.call(this, config);