In my XUL application, I open a dialog window, by this code:
var win = myWindow.openDialog("chrome://mywindow/content/mydialog.xul",
"Dialog creation",
"chrome, dialog, modal, resizable=yes",
params).focus();
And I access the information passed by user, by this code:
if (params.out){
dialogVariablesValues = params.out['inputValues'];
sameDialog = params.out['sameDialog'];
(...)
}
When the OK button in the dialog window is clicked, the window is closed, the if (params.out) becomes true and I can get the values. I don’t have any problem with this approach. The problem is that I need to change my dialog window to be dependent. So I have changed the code to:
var win = myWindow.openDialog("chrome://mywindow/content/mydialog.xul",
"Dialog creation",
"chrome, dialog, dependent, resizable=yes",
params).focus();
But params.out is always null…
Does anyone know how I can get the values when the dependent dialog is closed?
With a dependent dialog the execution continues after the
openDialog()call even though the dialog is still open. So you want your code to be “notified” when that dialog is closed. The easiest solution should be passing a callback in the params and changing the dialog to call your callback when it is closed. So the code opening the dialog would look like this:And the dialog would have code like this: