Windows memory management question

I’m confused by how to manage pop-up windows. My application has 5 windows the user can open by clicking on buttons They are all modal.

At the end of the apps, main page, there is this statement:

<script type="text/javascript">
	var dhxWins = new dhtmlXWindows();

And this is the code which typically opens a window:

function openPointsDialog() {
var openPointsWindow = dhxWins.createWindow(“w1”, 200, 200, 620, 337);
openPointsWindow.setText(“Calculate Points, Fees & Prepaid Interest”);
openPointsWindow.attachURL(“points.htm?etc=” + new Date().getTime());

Please explain what is happening (I’ve taken this project over and did not write this code).

The “new dhtmlXWindows();” is where the memory is allocated, right?

Is the method, createWindow also alocating memory?

At no time has the previous coder ever called the “unload()” method. Shouldn’t this be done? But I guess it should not happen whenever a window closes, because if it does, the “new dhtmlXWindows();” has to be called again. Is this right?

Basically, are calls to unload() paired with calls to “new dhtmlXWindows();” or with “createWindow()”? Or neither?

The reason why I’m asking this is because when a window opens, it seems as if the javascript that I posted never finishes executing. The progress bar at the bottom of IE8 never indicates that the window has fully loaded. Even after closing the pop up Window, the progress bar still indicates code is running. Is this an IE8 problem, or my problem?

Comments? Help?


If the same window can be opened/closed several times, it would be better to disable window closing and call hide() method instead:

var openPointsWindow;

function openPointsDialog() { if(!openPointsWindow){ var openPointsWindow = dhxWins.createWindow("w1", 200, 200, 620, 337); openPointsWindow.setModal(true); openPointsWindow.setText("Calculate Points, Fees &amp; Prepaid Interest"); openPointsWindow.attachURL("points.htm?etc=" + new Date().getTime()); openPointsWindow.denyResize(); openPointsWindow.denyPark(); openPointsWindow.attachEvent("onClose",function(){ openPointsWindow.hide(); }) } else; }

Note that onClose event doesn’t return true in this sample. For this reason, the window won’t close (remove) when “x” button clicked.

The progress bar at the bottom of IE8 never indicates that the window has fully loaded.

We have not reproduced the problem locally. You may attach the complete demo if the problem is stil actual.

Thank you for your reply. I’ll try your suggestion.

However, I was wondering if you could answer my other questions? I’m not going to try to create an example project that demonstrates the problem of the IE status bar. The only reason why is because I’m using a ver of the tools date around Nov. 2009. And possibly, if there was a bug, it has since been fixed. (Unfortunately, I’m not in a position to upgrade at this time.)


No sure whether there were fixes for this problem. However, you may try to check if the problem can be solved using the latest version - include the latest windows libraries (the API was not changed).