Wait Statement and Dialog: wait never ends

I found that if a dialog is open, and a procedure is running and encounters a wait statement, the wait never ends. The procedure will resume once the dialog is closed. This code, for example, will stop at the wait statement until the dialog is closed (you can hear the beep a soon as you close it.)

opendialog "A"
wait 1
beep
closedialog

The wait period is irrelevant to the issue.

I can confirm that dialogs are not compatible with the wait statement. When a modal dialog is open, all other Panorama activity is frozen until the dialog closes. So I think what is happening is that the wait is happening, but at the end of the wait Panorama is not able to resume the code after the wait, because that activity is frozen.

If you want a dialog to automatically close after one second, you’ll need to use a regular loop, just keep checking until 1 second (or whatever time you choose) has gone past.

Or instead of using opendialog, you could use the rundialog statement, which has an automatic timeout feature. In fact, honestly, I would suggest that you NEVER use the opendialog statement, I never do. I always use the rundialog statement which has lots of nice features to help with smooth dialog operation.