trap for (plug-in) dialog closed?

In this routine:

if ([thing we test for])
{
var diaLog = plugins.dialogs.showWarningDialog
(‘[alert]’,‘[message]’,‘Cancel’,‘Proceed’);
application.output(diaLog)
if (diaLog == ‘Cancel’)
{
return
}
databaseManager.startTransaction();
[whatever happens next]
}

… I would like to have the resulting behavior the same whether the user clicks the ‘Cancel’ button or whether they close the dialog by clicking on the little red and white X in the corner of the dialog (‘close button’).

I could reproduce the functionality in a FID, and methodically control the close button. But I’d like to understand how to accomplish this when using a the dialog plug-in.

Essentially, this amounts to trapping for the dialog closing.

How can that be done?

Jim

Hi Jim,

I believe when a dialog is closed with the close widget then it will return an empty string. So you check if nothing is returned (no button was pressed) then they have closed the dialog with the X.

Hope this helps.

Yes! Thank you, Robert. :)

Slight variation: changed the one line to:

if (diaLog !== ‘Proceed’)

…and it did the trick.

Jim