How to create a User Interface - Part 5

Tekla Tedds
Tekla Tedds for Word
Not version-specific
Tekla Tedds Tekla Tedds for Word
Environment
Not environment-specific
This is the fifth part of a step-by-step guide showing you how to use the Tedds Interface Designer to create user interfaces for your own custom calculations. In this part, you will enhance the user interface created in part 4 to prevent the user from entering invalid values.
This guide is written for Word 2007/2010 some of the steps described may be slightly different if you are using an older version of Word.

Input Validation

A key aspect of user interface design is to ensure that the user can't enter values that don't make sense, particularly values that would cause any subsequent calculations to error or to produce incorrect results. "Garbage in Garbage out", if the input is nonsensical the calculations will produce nonsensical results. Input validation ensures that the user can only enter values that are within the bounds of what is expected, for example a length value would typically be a positive value greater than 0.

Validation Properties

Input controls have several different validation properties which are outlined in the table below:

 

Control Function
Min value Minimum value (including units) that will be accepted
Max value Maximum value (including units) that will be accepted
Expression Expression that when calculated must return a non-zero value (True) for the input to be accepted
Message Validation error message that will be shown to the user if the input validation for this control fails

 

Each of the different types of input control supports a different set of these validation properties. In addition some controls implicitly limit the input the user can make, for example a checkbox only has two possible values, the checked value and the unchecked value.
Input validation occurs when the user clicks the Next/Finish button. Each input control is checked in turn and the validation for that control is calculated to ensure that the input is valid, if any of the validation checks fail then the user will be prompted with the validation error message. If you do not specify a validation message Tedds will automatically create a message that is appropriate for the failure condition. If any of the input controls fail validation the user will not be allowed to proceed and they must amend their input until all of the validation checks succeed.

Enhancing the user interface

Start by defining appropriate validation for the Minimum yield strength:

 

  1. Open the document created in part 4 and start editing the user interface.
  2. Select the Minimum yield strength input control.
  3. Change the Min value property to 275 N/mm^(2)

 

Close the user interface, return your changes to the document and then re-calculate the document.
Enter a value of 0 for the Minimum yield strength and click Next; you should now see the improvement to the user interface as you will be prompted with a validation error message that has been generated automatically by Tedds based on the minimum value that you defined.

 

Image
Image1.png

 

Now amend the validation for all of the other input controls:
  1. Start editing the user interface.
  2. Select the Tie force input control.
  3. Change the Expression property to T_{f} > 0 kN
  4. Change the Message property to Tie force must be greater than 0 kN
  5. Select the Effective length input control.
  6. Change the Min value property to 100 mm
  7. Change the Max value property to 10 m
  8. Select the Slenderness limit input control.
  9. Change the Expression property to \6C_{L} > 0
  10. Select the Section area input control.
  11. Change the Expression property to A > 0 mm^(2)
  12. Select the Radius of gyration about x input control.
  13. Change the Expression property to r_{xx} > 0 mm
  14. Select the Radius of gyration about y input control.
  15. Change the Expression property to r_{yy} > 0 mm
Close the user interface, return your changes to the document and then re-calculate the document.
Enter a value of 0 for the Tie force and click Next, you will be prompted with the validation error message that you defined.
Image
Image2.png

Summary

You've now updated your Tedds user interface to prevent the user from entering invalid data. Defining validation for your user interfaces will make your calculations more robust and will help to make them easier to use by others because the user is prevented from entering inappropriate data. You can find out more about creating your own user interfaces by searching for "Interface Designer" in the Tedds help.
Was this helpful?