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.
Code:
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,
listeners:
{
show: function()
{
xGlob = xGlob-20;
yGlob = yGlob-20;
}
}
}, config);
Ext.ux.Window.superclass.constructor.call(this, config);
}
});