Modal window block js thread?

I have the following question. Is it possible to get a modal dhtmlx window to block the current thread until the window is closed? For example I have the following html and javascript.



HTML

---------------











Javascript

---------------

function okayToContinue() {

var dhxWins = new dhtmlXWindows();

dhxWins.setImagePath("…/Common/dhtmlxWindows/codebase/imgs/");



var win = dhxWins.createWindow(“w1”, 270, 170, 350, 120);

win.setText(“Delete Excess Values?”);

win.setModal(true);

win.attachObject(“obj”);

win.button(“close”).disable();

win.button(“park”).disable();

win.button(“minmax1”).disable();



/******

Here I want to block the thread until the user makes a selection and then return true or false depending on their selection.

******/



}





Do you have info on how to block the thread? I can think of some workarounds, but they’re a smidge messy and not at all elegant.



Thanks,



Tim.



There is no real “block thread” solution, which will work in all browsers. The only way to organize necessary logic - split code in two functions, frst one will end after creating modal window, second - will be called from onClose event of window.