Contents - Index
Using Drop-Down Lists to Set One or More EES Variables
When a string variable is selected for input in the Diagram Window, a check box option to Use string list will be available. An Edit button will appear to the right of the Use string list check box which will allow the existing choices to be viewed and/or changed in a dialog window, as shown in the figure on the left. The strings that entered into this dialog will appear in the Diagram window as a drop-down list box which displays the available choices when the user clicks in the box as shown in the figure on the right.
The Read strings from file option is available in the Professional version. In this case, the string information resides in a separate file. EES will check date-time stamp of this file each time it displays the drop-down list and update the choices as needed. The Read strings from file option allows the string choices in the Diagram window to be changed without any required changes in the EES file or the EES Distributable program.
It is possible to use the strings in the drop-down list to set the values of one or more EES variables. This is accomplished by following the string that is to be displayed with characters // and then with one or more EES equations on one line. The total length of the line must be less than 255 characters. For example, suppose you wish to use a drop-down list to have a user select the density and thermal conductivity of one of several substances. You could create a drop-down list with the following strings
If the Execute EES commands when the selected item is changed checkbox is checked, the commands to the right of // will be immediately processed and EES equations will be recompiled as needed and update the Diagram Window display if necessary. If the checkbox is not selected, the equations to the right of // will be processed when calculations are initiated. If the
Format Display control in the Modify Diagram Text dialog is checked, the drop-down list will only show the characters to the left of //. Execute EES commands ... is checked by default. Unchecking it can speed up the response time in the Diagram window for large EES programs.
An interesting extension of this concept is provided in the last string of this list which is 'User Input // density=?; conductivity=?'. In this case, EES interprets the '=?' to mean that the value of the variable should be entered in an edit box. In order for this to work, the variables density and conductivity must be displayed on the Diagram window as Output variables. When the 'User Input' item is selected, EES will look for these Output variables and change them to Input variables. The general capability afforded by the '=?' notation is that selected variables can be changed from Output to Input or from Input to Output variables on the Diagram Window by a user selection from a drop-down list.
Note that you can also use the $INCLUDE directive in the drop-down string, as in the following example.
Program 1 // $Include IncludePrgm1.txt
When Program 1 is selected in Application mode, EES will open and compile the equations in file IncludePrgm1.txt. These equations will be executed when the calculations are initiated. The .txt file can contain any number of EES equations, thereby eliminating the 255 character limitation.