PDA

View Full Version : Window mask



spinnerdog
5 May 2010, 11:16 AM
Hi,

How does one mask and unmask the content area of the window? I've tried window.dom.mask() and several other things but can't figure it out.

Thanks.

gevik
5 May 2010, 2:20 PM
Hi,



/* STEP1 : create a window */
var win = new Ext.Window({
width:320,
height:200,
title:'test window'
});

/* STEP2: show the window */
win.show();

/* STEP 3, method 1 */
win.el.mask();
//win.el.unmask();


/* STEP 3, method 2 */
var loadMask = new Ext.LoadMask(win.el,{
msg:'Please Wait...'
});

loadMask.show();
//loadMask.hide();


If you need to mask the content area only, then use win.body instead of win.el in the code above.
If you need to mask the entire browser page then use the LoadMask with Ext.getBody().

Hope this helps.

spinnerdog
5 May 2010, 3:09 PM
Hi,

Thanks for the reply. I tried both body.mask and el.mask.

body.mask produces this error in IE: invalid targete element for this operation.

using body.el doesn't seem to mask the window.

My code is like this.
FVPreviewWin = Ext.extend( Ext.Window, {
initComponent: function(){
FVPreviewWin.superclass.initComponent.call(this);
},
showFile: function(){
this.body.mask();
this.body.dom.src = Ext.BLANK_IMAGE_URL;
this.setTitle( this.ContentsGrid.selModel.getSelected().data.Name );
this.getTopToolbar().items.items[4].setText( 'of ' + this.ContentsGrid.selModel.getSelected().data.PI );
this.getTopToolbar().getComponent('PageNo').setValue( 1 );
this.getTopToolbar().items.items[8].setValue( this.ContentsGrid.selModel.getSelected().data.Checked );
this.loadImage();
this.body.unmask();
},

Any suggestions are welcomed.

Thanks.

gevik
5 May 2010, 11:04 PM
The body element of a Window is not created until the window is visible. So, for any masking to work, your window must be visible first.