Anatomy of a Dialog Box Menu File

 

Consider the following simple dialog box:

 

// dialog1.pan

@dialog

 

A Simple Dialog Box

 

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

<L>

~menuclear

 

The dialog box appears as:

 

 

 

 

Statements at the top of the menu file include comments (lines that begin with // or !), lines that begin with special @ functions that indicate how the menu file is processed (e.g., positioning, type, formatting), lines enclosed by curly braces {} that are evaluated when the menu is invoked, and lines of text for the menu title and display.  Following this section is the main body of the menu file.  The main body of the menu file tells what to display to the user when the menu is invoked, as well as what types of input are required.  In a dialog box, there are three components on each line separated by a tilde (~).  These components are referred to as the display area, the expression area, and the input area.

 

 

1

 

2

 

3

Generate Function<>

~

<> (100, .1)

~

<GRANDOM><GNORMAL>

Display area

 

Expression area

 

input area

 

 

  1. The display area, from the left margin to the first tilde (~) character, specifies the type of control that appears to the user when the menu is invoked.  The display area can contain a pair of braces < > separated by spaces for an input field. A number of optional modifiers (usually single characters separated by spaces) can be placed within the < > to alter the style or behavior of a control. By default, the number of spaces between the angle brackets < > in the menu file determines the length of the displayed input field. The display area of dialog1.pan is highlighted here:

     

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

     
     
  2. The expression area is the group of commands and text between the two tildes on each line.  This is where the expression that gets passed to DADiSP is stored. This section is created dynamically and contains the userís choice from the third section. Here it is not important how many spaces you have between the angle brackets < >, as long as there is at least one space. When DADiSP evaluates the dialog box (when all the required inputs have been supplied), the statements in the expression area hold the values of the userís last choice from the list box or input. The expression area of dialog1.pan is highlighted here:

     

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

     
     
  3. The input area is the text and commands to the right of the second tilde (~). This is where the userís input choices are made. DADiSP evaluates the input area expression when the user selects the line by clicking on the list box or the field in the dialog box. In many menus, the INPUT function serves as the input vehicle. In other menus, the user can choose from a list box. The input area of dialog1.pan is highlighted here:

     

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

     
     
  4. The last line or lines of the menu file that begin with a tilde (~) character contain commands to be processed by DADiSP after the OK button and expression area commands are executed.  These are called the end execution statements. The end execution statement for this example is:

     

    ~menuclear

     

    The execution statement area of dialog1.pan includes the special  formatting statement <L> that displays a line between the body of the dialog box and the automatic OK Cancel buttons. Formatting lines can be used to clarify the presentation of a dialog box.