Categories | Question details Back To List | ||
onClose event Hello, I have detected two ways to calling events: onMoveFinsih event: if (win.checkEvent("onMoveFinish")) { win.callEvent("onMoveFinish",[win]); } else { this.callEvent("onMoveFinish",[win]); } onClose event: if (win.checkEvent("onClose")) { if (!win.callEvent("onClose", [win])) return; } else { if(!this.callEvent("onClose", [win])) return; } The onClose event has an if-return statement, why is it? I must return true in my event handler... Answer posted by Support on Sep 05, 2008 02:41 The result of onClose event control behavior of window. If your custom code attached to onClose event returns true - window will be closed false - window will not be closed Answer posted by Vincent on Sep 16, 2008 04:20 Hi I try to use this behavior in my script: I have a button which opens a window. The content of this window is an attached div where I place dynamic html which should not be lost. When the user click on this button the window is opened, then he clicks on the Close button to hide the window without destroying it. When he clicks on the button for the second time, the window is shown. if (!dhxWins.isWindow('project_description')){ dhxWins.createWindow('project_description', 100, 100, 500, 400); dhxWins.window('project_description' ).attachObject('project_description_div', true); dhxWins.window('project_description' ).setModal(false); dhxWins.window('project_description').button("close").attachEvent("onClose", function(win) { win.hide(); return false;}); }else{ dhxWins.window('project_description').show(); } The theory is great but it doesn't work. 'project_description' is not a window after onClose is triggered, dhxWins.isWindow returns false and a second window is created with js errors. Why ? Vincent Answer posted by Vincent on Sep 17, 2008 06:23 Oups! The correct line is: dhxWins.window('project_description').attachEvent("onClose", function(win) { win.hide(); return false;}); It works well. Vincent |