Controls > Advanced Controls > List Box > Example: List Box
Example: List Box
In this example, you can return the item number or convert the selection to a string.
1. On the Input/Output tab, in the Controls group, click Advanced > List Box.
2. Enter the output variable name for the List Box on the left side of the definition operator.
3. On the right side of the List Box, add the list of items. In this case, it is a list of materials:
a. Right-click the List Box and select Edit.
b. Make sure you are on the Script Editor tab.
c. Edit the AddString method in the script.
d. Click Apply and Close.
* 
Copy this example to your PTC Mathcad Prime worksheet to see the script that was used here.
4. To define the list box’s Properties, right click it and select Edit. Then, switch to the Properties tab and edit the properties. You can also select the Script Editor tab and edit the list box's properties from the script.
Click to copy this expression
5. This list box takes user input in the form of a selection and returns the value as a string.
Click to copy this expression
6. Create another List Box. The script of the second list box contains the available property definitions for each material. The list is populated based on the material you choose. The list box uses the Material variable for calculations within its script. Note the use of input and output variables.
Click to copy this expression
7. Define a Tension variable.
Click to copy this expression
8. Calculate Tension for each material.
Click to copy this expression
9. The example above is in VBscript. Copy the following examples to see the script in Jscript.
Click to copy this expression
Click to copy this expression
Was this helpful?