How to check if a dhtmlxwindow had already been opened

Hi,

I had recently started looking at this amazing work you had done in giving all these advanced Web UI Controls. I implemented dhtmlxWindows which was attached to a underlying database table. I checked out all your blogs and also your API to find out a method to know if the dhtmlxWindow is open.

My logic is as such on click of a button on a page i was binding the window. Right now its creating a new window on further clicks. I tried out options like dhxWins.window(id), dhxWins.isWindow(id).But all the efforts in vain. Could you please let me know if there is a way to know whether that window had been open. Here is the code which i had used.

var w1=null;
dhxWins = new dhtmlXWindows();
if(!dhxWins.window(“w1”)){

dhxWins.enableAutoViewport(true);
dhxWins.setImagePath("dhtmlxGrid/codebase/imgs/");
w1 = dhxWins.createWindow("w1",420,300,600, 550);

dhxWins.window(“w1”).attachURL(“XmlPage.aspx”);
}
else{
}
I would really appreciate your help on this.

Regards,
Ram.

You may use show() method:

[code]var dhxWins;
function openInWindow(obj) {
if (!dhxWins) dhxWins = new dhtmlXWindows();
if (!dhxWins.window(“w1”)) {
var w1 = dhxWins.createWindow(“w1”, x, y, w, h);
w1.attachURL(“XmlPage.aspx”);

   /*necessary to hide window instead of remove it*/
    w1.attachEvent("onClose", function(win){
        if (win.getId() == "w1") 
            win.hide();
    });

} else {
   dhxWins.window("w1").show();
}

}[/code]

Thanks a lot alexandra. That works. I appreciate your help.