How a Dialog Box is Processed


When a dialog box is invoked, DADiSP processes the top portion and the display area of the menu to determine how to interpret the menu file syntax and display it for the user.  The user clicks on input fields and/or makes selections to fill all the input areas in the menu. As this occurs, DADiSP executes statements from the input area, making substitutions in the braces < > of the expression area.  


If the user clicks the Cancel button, the menu is cleared, and no other statements are executed.  If the user clicks OK, the substituted statements in the expression area are executed sequentially from top to bottom, followed by the end execution statements.  


Let's take another look at the dialog1.pan menu:


// dialog1.pan



A Simple Dialog Box


Generate Function <     >~< >(100,.01)~<GRANDOM><GNORMAL>




The @dialog option tells DADiSP to interpret this as a dialog box. The title of the menu is A Simple Dialog Box.  This is displayed in the banner at the top of the menu.  



If the menu file contains any expressions in {}, each expression is evaluated and the resulting values are substituted in the {} before the dialog box is displayed. dialog1.pan does not include {} expressions.


When invoked, our dialog box displays the following line:


Generate Function   GRANDOM


Clicking the down arrow button allows the user to select either GRANDOM or GNORMAL. The selected text is substituted where the braces < > occur.  If the user clicks the Cancel button, nothing happens and the dialog box is dismissed.  If the user clicks OK, whatever was selected in the input field is substituted into the expression area.  


Generate Function <     >~< >(100,.01)~<GRANDOM><GNORMAL>


For example, if the user selected GRANDOM in the input field, the expression area statement becomes:




because the text GRANDOM is substituted into the <> of the expression area.


Generate Function <     >~GRANDOM(100,.01)~<GRANDOM><GNORMAL>


A 100 point, 100 Hz waveform is calculated and returned to the current Window.


Finally, the end execution statement, menuclear, is executed and the dialog box is cleared from the screen.


In summary, the following steps are performed when a panel or dialog box is invoked:



Read the menu file specification.


Evaluate all expressions in {} and substitute return values, if any.


Process special @ options that modify the entire dialog box.


Identify and display the dialog box title.


Display controls specified by each display area line.


Once displayed, evaluate the corresponding input area statements in response to user interaction with the dialog box controls.


Finally, when the OK button is pressed, process the dialog box:



Sequentially evaluate each expression in the evaluation area with the selected substitutions.


Sequentially evaluate each execution statement following the ~ character.