Controls > Advanced Controls > Button > Example: Button
Example: Button
You can use the Button advanced control to perform calculations on input and then deliver feedback to the user. In this example, two vectors are compared. The first vector represents a student’s answers to a test, the second represents the teacher’s answers. The button calculates the student’s grade.
1. Create two vectors: one for the student’s answers, the second for the teacher’s answers.
Click to copy this expression
Click to copy this expression
2. To create the Button,
on the Input/Output tab, in the Controls group, click Advanced > Button.
3. Enter an output variable name for the Button before the definition operator.
4. To define the button’s Properties, right click it and select Edit .Then, select the Properties tab and edit the Name. You can also select the Script Editor tab and edit the button’s name from the script.
* 
Copy this example to your PTC Mathcad Prime worksheet to see the script that was used here.
5. Calculate the student’s grade using the button. The first example is in VBscript, the second is in Jscript:
Click to copy this expression
Click to copy this expression
Was this helpful?