Have to repeat twice to make it work

I have the following code snippets:

in my index.html in my doOnLoad() function:

winMenuOpts = new dhtmlXWindows();
...
...
winMenuOpts.createWindow('winMsg,20,20,xsize,ysize);
winMenuOpts.window('winMsg').hide();
winMenuOpts.window('winMsg').button('park').hide();
winMenuOpts.window('winMsg').button('minmax1').hide();
winMenuOpts.window('winMsg').button('minmax1').disable();

I also have the following function:

function openMsg(xsize, ysize, msg)
{
	winMenuOpts.window('winMsg').setDimension(xsize, ysize);
	winMenuOpts.window('winMsg').center();
	ifrMsg.contentWindow.showMsg(msg);
	winMenuOpts.window('winMsg').show();
	winMenuOpts.window('winMsg').bringToTop();
	winMenuOpts.window('winMsg').setModal(true);
}

If I call openMsg function ONCE then winMsg cannot be seen. However if I call it TWICE then winMsg can be seen.

Please can you tell me what I’m doing wrong.

Thanks

Purvez

Try to show a window then call all other methods:

function openMsg(xsize, ysize, msg) { winMenuOpts.window('winMsg').show(); winMenuOpts.window('winMsg').setDimension(xsize, ysize); winMenuOpts.window('winMsg').center(); ifrMsg.contentWindow.showMsg(msg); winMenuOpts.window('winMsg').bringToTop(); winMenuOpts.window('winMsg').setModal(true); }