How to create a User Interface - Part 6

Tekla Tedds
Tekla Tedds for Word
Not version-specific
Tekla Tedds Tekla Tedds for Word
Environment
Not environment-specific
This is the sixth 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 5 to show a sketch of the currently selected steel section within the user interface.
This guide is written for Word 2007/2010, some of the steps described may be slightly different if you are using a different version of Word.

Creating a sketch

For the purpose of this example your first task is to create sketches for each of the steel section types that can be selected (I, Channel, T, etc.). You can use any drawing application to do this as long as the application will allow you to paste the drawing into Microsoft Word, however in order to focus on the task at hand you'll just use Word to create a 'very' simple sketch of each section type.
  1. Create a new document in Tedds for Word.
  2. Select the Insert tab on the ribbon and then select Shapes, Basic Shapes and Rectangle.
  3. Draw three rectangles to form the outline of an I section.
  4. You may want to modify the properties of the rectangles so that the shapes use a solid fill with no outline.

 

Image
Image1.png
Repeat the steps above to create similar sketches for each of the section types that can be selected from the Data list.

Storing a sketch

Once you have created all of your sketches they must be saved to a Calc Library so that your user interface can retrieve and show the appropriate sketch. If you're unfamiliar with saving calculations to a Calc Library please refer to Calc Library options.

 

  1. Open the Library Access System (LAS).
  2. From the File menu select New Blank Set.
  3. From the Edit menu select New Item.
  4. When prompted to select the Word content to save, make sure you select all of the rectangles you've used to create the I section shape. You can do this by clicking on each shape in turn whilst holding down the Shift key.
  5. For the item Name enter Section sketch - I.
  6. For the Library, click the Select... button and then enter the new file name Steel section tie design

 

Image
Image2.png

 

Repeat the steps above to save each of the sketches you've created as separate Calc Items with the appropriate item name. You can determine the name to use for each sketch by checking the value of the 'type' variable when that section type is selected from the Data list. So for example the channel section sketch will be named "Section sketch - C" because for a channel section the type variable has a value of "C".

Showing a sketch in the User Interface

Now that you have created all the required sketches you need to modify your existing user interface to show the appropriate sketch. To do this you first need to change the page template layout that your user interface is using. The template layout determines how the controls on your page are arranged and whether any library items will be shown in the interface.

 

  1. Start editing the user interface.
  2. Using the properties window change the Template - Size property to Large.
  3. Change the Layout property by clicking on the [...] button and then select template Number 10, which has a calc item that fills the left side of the user interface and the other controls listed down the right side.
  4. Select the sketch window by clicking on it.
  5. Change the Library property by clicking on the [...] button and select the Steel section tie design calc library which you saved your sketches to earlier.
  6. Change the Library item property by clicking on the [...] button and select the Section sketch - I calc item.
Image
Image3.png

 

When you re-calculate your document you should see your I section sketch shown in the user interface, however if you select a different type of section the user interface doesn't show the appropriate sketch it always shows an I section. To fix this you need to use an expression for the library item property which will determine the name of the appropriate Library item.

 

  1. Start editing the user interface.
  2. Select the sketch window by clicking on it.
  3. Expand the child properties of the Library item property by clicking on the small triangle to the left of the property name in the property window.
  4. Modify the Calculate as expression property to True
  5. Modify the Library item property to if(type=="C", "Section sketch - C", "Section sketch - I")

 

When you re-calculate your document you should see that if you change the type of selected section between an I section and a Channel section the sketch updates accordingly. However you now need to modify your expression to accommodate all of the different section types available which will require a much longer and more complex expression. An alternative approach is to create the name of the Calc Item that is required for each section by using a very simple expression that concatenates the two parts of the string "Section sketch -" + type. This is possible because you we're asked to save all of your sketches using very consistent names hence you created a simple pattern for naming the items. This is just one example of why choosing sensible and consistent names for the items you store in your own libraries can help to make your calculations much easier to write. This approach also has the benefit of being much easier to maintain, if for example in the future a new type of section we're added to the steel section data list you would only need to add a new sketch in your library with the appropriate name, you wouldn't need to modify your user interface at all because the existing expression would automatically work for the new section type.

 

  1. Modify the Library item property to "Section sketch - " + GetVar("type","None"))
When you re-calculate your document you should see that the sketch now updates correctly for all section types. Note that the GetVar function has been used to get the value of the 'type' variable because the first time the user runs the calculation they will not have selected a section therefore the type variable will not exist. You may also want to create a library item named "Section sketch - None" with appropriate text that simply informs the user that a section has not yet been selected.

Summary

You've now updated your Tedds user interface to show the user a sketch of the steel section they've selected. Adding sketches to your user interfaces will help to make them easier to use by others because the sketch provides additional information to the user. You can find out more about creating your own user interfaces by searching for "Interface Designer" in the Tedds help.
Was this helpful?