Windows.close function overide

Before closing a window I would like to run some confirmation tasks and tidy up. I attached an “onClose” event (global) handler but the window doesn’t close with explicit close() method.

[code]…


The lack of attention to consistency with form, function and documentation of the DHTMLX product creates unnecessary anxiety for learning developers!
Alas, us noobies have to struggle along, attempting to discern the relevance of documentation and code snippets
... var dhxLayout, atabbar, dhxWins, w1, myTree;
...
function doOnLoad() {
  ...
  dhxWins = new dhtmlXWindows();
  dhxWins.enableAutoViewport(false);
  dhxWins.attachViewportTo(document.body);
  // global handler
  dhxWins.attachEvent("onClose", function() {
      alert("button \"Close\" was clicked");
      processToolbar("copy", "");
      //w1.detachObject(true);      // this detaches the 'someobject' but not all
      dhxWins.window("w1").close(); 
  });
}		

function taskForm(id){

dhxWins.setImagePath("codebase/imgs/");
w1 = dhxWins.createWindow("w1", 175, 20, 780, 700);
w1.setText("Task edit/entry: " + id);
myBar = w1.attachToolbar();
myBar.setIconsPath("codebase/imgs/dhxtoolbar_dhx_skyblue/");
myBar.loadXML("common/dhxtoolbar_button.xml?" + new Date().getTime());
myBar.attachEvent("onClick",function(id){
  processToolbar(id, "");
		});
}

function processToolbar(bid, qual){
document.getElementById(“stext”).value = “button(”+bid+“) was clicked”;
switch (bid){

  case "open":
    w1.attachObject('someobject');
    createEditor();
    break;
  case "save":      
  case "cut":
    removeEditor();
     w1.detachObject('someobject');
    //createEditor();
    break;     
  case "copy":
    w1.detachObject('secondobject');
     //removeEditor();
     break;
  case "paste":
    w1.appendObject('secondobject');
    createEditor();
    break;
   
  default:

    break;      
}

}

</script>[/code]

Why doesn’t the window destruct?

Hi

dhxWins.attachEvent(“onClose”, function(w1) {
alert(“button “Close” was clicked”);
processToolbar(“copy”, “”);
//w1.detachObject(true); // this detaches the ‘someobject’ but not all
// dhxWins.window(“w1”).close(); <-- incorrect
// correct
return true; // allow closing, or “return false” - not allow
});

Thank you.