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.  

 

                  

 

Normally, EES will determine the maximum width of the items in the drop-down list and set the width of the drop-down control accordingly.  However, if you uncheck the Set width automatically check box, an input box will appear in which you can set the width of the drop-down box.  This capability is useful when there is more than one drop-down box and you wish to have them all be the same width.

 

The Read strings from file option is available in the Professional license.  In this case, the string information resides in a separate file.  EES will check the 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

 

 

An interesting extension of this capability is provided in the last string of this list which is 'User Input // rho=?; c=?'.  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 rho and c must be displayed on the Diagram window as Output variablesWhen the 'User Input' item is selected, EES will look for these Output variables and change them to Input variablesThe 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.

 

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.

 

If the Set width automatically checkbox is checked, the with of the drop-down list holding the selected text will be automatically set to the largest item in the list of string.  If it not checked, a edit box will be provided to enter the width of the drop down control

 

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.