How to place Cancel and OK buttons on a modal form?

The Help entry for the rundialog statement includes the following:

"A form generally needs some special preparation to be used as a modal dialog. At a minimum, you probably want to include Ok and Cancel buttons. These buttons should be set up with a one line procedure:

resume {}

In fact, any button contained in a dialog form should contain this one line procedure."

There are no examples of how or where this statement is used and I’ve tried all sorts of things to get it to work without success and I don’t understand what “any button contained in a dialog form should contain this one line procedure” means. Setting a button to trigger this statement does nothing visible.

I’m sure all of the entries relating to modal dialogs are useful to somebody who already knows how to use them but it’s a bit of a circular argument for a beginner.

Any advice is welcome.

… and when I try to run this minimal procedure (copied from the Help page),

loop
    rundialog {Form=Address Height=120 Width=400}
    stoploopif info("trigger")="Dialog.Close"
endloop

… I have to run it twice to get the dialog up. And statements following the loop aren’t executed until I run the procedure a third time.

Can anybody replicate this?

Statements following the loop should never run until the Ok or Cancel button is pressed.

The

resume {}

statement won’t do anything normally – only when used in a dialog that was opened with the rundialog statement. So you can’t “test” the button other than using rundialog.

Starting on page 489 of the Formulas & Programming PDF book (Panorama 6) there is a description of how to set up a form to be used as a dialog. Panorama X is a bit different but pretty close, so this should be useful to you. Unfortunately some of this has not been written up in the Panorama X documentation yet. The Dialog Workshop is very useful, I always use it. Again, it is a bit different in Panorama X but you can probably figure it out. If a future reader doesn’t already have this PDF file it can be downloaded here:

http://www.ipodorganizer.com/Downloads/pdf/60/Formulas%20&%20Programming.pdf

I should have thought to do that - those books are still an excellent resource. Maybe you could include the odd reference to them in those parts of the Panorama X Help wizard where you are still catching up.