PDA

View Full Version : window show position



ci11111
26 Mar 2012, 4:55 AM
I'm showing 2 windows on startup, they are put exactly over each others
the show() method puts it centered, is there a way, to put a small X, and Y lag between the 2 windows, or to dock one below the other?

sskow200
26 Mar 2012, 5:28 AM
Ext.onReady(function() {

var window1 = Ext.create('Ext.Window', {
title: 'Window1',
autoShow: true,
renderTo: Ext.getBody(),
x: 200,
y: 200
});

window1.on('show', function() {
var window2: Ext.create('Ext.Window', {
title: 'Window2',
autoShow: true,
renderTo: Ext.getBody(),
x: window1.getXY().x + window1.getWidth(),
y: window1.getXY().y

});
});

});

ci11111
26 Mar 2012, 5:32 AM
thanks

sskow200
26 Mar 2012, 5:35 AM
The important part here is you have to wait until the first window loads, before you can get its xy coordinates to base the next one off of...

hope that helps

ci11111
26 Mar 2012, 5:46 AM
problems I'm not entering in the show event, (putted console.log)

ci11111
26 Mar 2012, 10:31 PM
well sorry but its not working if I don't position the 1st window (200, 200) in your code
Any idea?
Can I apply a layout to have windows centered, but still draggable