PDA

View Full Version : SOLVED: Window center function



dias
16 May 2009, 8:43 AM
Hello,

I have this code:



window.onresize = function(){
Ext.getCmp('wizard').center();
}


It works in version 2... but in version 3 i have this error

Ext.getCmp("wizard").center is not a function

Can someone help me?

Thanks in advance

Paulo

aconran
17 May 2009, 6:01 AM
Have you created an Ext.Window? Try to dump out the wizard returned from Ext.getCmp to the console and investigate what it is.

dias
17 May 2009, 10:26 AM
Ok, i try that.

dias
17 May 2009, 1:38 PM
I have resolved the problem of the center function (i made a stupid error, in properties center: true).

I now use this code to center the window in a browser resize:



window.onresize = function(){
var x = Ext.getCmp('wizard');
x.center();
//console.log(x.x); console.log(x.y);
}


This works in Firefox. But in IE8 this no center the window correctly.

Thanks in advance,

Paulo

Animal
17 May 2009, 11:46 PM
You should use http://extjs.com/deploy/ext-3.0-rc1.1/docs/?class=Ext.EventManager&member=onWindowResize

dias
18 May 2009, 3:00 AM
Thanks...

Solved with:



Ext.EventManager.onWindowResize(function(){
var winWizard = Ext.getCmp('wizard');
winWizard.center();
});

Rowan
28 May 2009, 4:22 AM
Is there a reason why this function isn't included in ExtCore, Event Manager has hardly anything in it - all the useful stuff is in the full release.

No Key listeners and no window resize event...

Any chance of adding them in?