PDA

View Full Version : Getting a reference to a Window's shadow



jnicora
27 Apr 2012, 8:40 AM
Not sure why I am having trouble with this, but what is the preferred way to programmatically show/hide a window's shadow?

I'd like to slideIn a window, but the shadow doesn't properly follow so I'd like to have it hidden, then display it on the animation callback.

jnicora
27 Apr 2012, 8:49 AM
Nevermind;

windowRef.getEl().disableShadow();
windowRef.getEl().enableShadow();

very simple.

jnicora
27 Apr 2012, 9:02 AM
Still have a problem, however. Once a shadow is disabled, you can no longer enable it?

Maybe there is a better way togo about this?

jnicora
27 Apr 2012, 9:10 AM
Found a workable solution, but it seems a bit odd.

windowRef.getEl().shadow.setOpacity(0); // hide
windowRef.getEl().shadow.setOpacity(50); // show

I'd rather be able to call the shadow's show/hide method, but the show method results in an error.

slemmon
27 Apr 2012, 2:32 PM
I got an error at first, too, but then noticed that the shadow's show() method requires a param of the element where the shadow will be shown. See the below example:



Ext.widget('window', {
autoShow: true
, width: 200
, height: 200
, listeners: {
afterrender: function () {
var me = this
me.getEl().shadow.hide();
Ext.defer(function () {
me.getEl().shadow.show(me.getEl());
}, 1000)
}
, delay: 1000
}
});