Interaction of wait statement with dialogs

It seems like the wait statement does not count while a dialog sheet is open. This code does not resume after the wait statement until the dialog is closed some other way:

opendialog “Splash2”
wait 2
closedialog
beep

Is there an alternative to my code that will close a dialog after a specified time period? I would like to run other code in the background while the dialog is open. The purpose of this is to prevent stray mouse clicks from interfering with the code that is running.

If you want other code to run you should put that code between the opendialog and closedialog statements.

I am making a slightly different point. The code reaches the wait statement, but never proceeds to the next line as long as the dialog is open.

Correct. The wait statement doesn’t work in dialogs. If it did, most dialogs would not work at all.

I am going to suggest an addition to the Help pages to point this out. My post was not to complain, only to make sure I understand the interaction of these two features. I have another comment to post shortly about the relation of timers and dialogs.

In that case, I better explain more fully. The wait feature uses a timer internally. The timer feature allows code to “pop-up” and run at a later time. But you probably don’t want code to pop up at certain times. For example, you probably don’t want timer code to start running when you are in the middle of editing a field. So when Panorama is about to run timer code, it checks to see if you are editing, and if so, it postpones running the time code until the editing is finished. It does the same thing for dialogs. All timer code is postponed until all dialogs are closed.

Of course there might be situations where you might want the timer code to run while editing or in a dialog. However, Panorama doesn’t allow that. Perhaps a future version could allow a time to specify more exact conditions for when the timer code is allowed to run, but at the moment, timer code can’t run during editing or dialogs.