User interface controls

Updated: 13 May 2019

Tekla Open API contains Windows Forms dialogs for several catalogs to help developers of .NET applications and plug-ins which have Forms and need to provide for example profile selection in UI.

Also “Save-Load-Save as” buttons and “OK-Apply-Modify-Get” buttons are available as custom controls.

Both buttons and catalog custom controls can be found in Tekla.Structures.Dialog.UIControls namespace. The namespace contains also dialog templates.

You can drag and drop a custom control from Microsoft Visual Studios Toolbox into a Form.

To add user interface controls to Microsoft Visual Studio’s Toolbox:

  1. Open the Form1.cs[Design] tab.

  2. On the Toolbox tab, right- click General and select Choose Items.

  3. Click browse, navigate to \Program Files\Tekla Structures\[version]\nt\bin\dialogs\Tekla.Structures.Dialog.dll, open the Designer and click OK.

Catalog custom controls

When a catalog button is clicked, the control enumerates the catalog and shows the items in a dialog. You can create a new instance of the profile / reinforcement / mesh selection dialog by passing a list of the items you want to show in the dialog.

The item that user selects will be stored to a public property (SelectedProfile, SelectedMesh, SelectedMeshName, SelectedMeshGrade, SelectedRebarSize, SelectedRebarGrade, SelectedRebarBendingRadius).

Setting the public property to a certain value selects the value from the dialog when the dialog opens (if the value is included in the catalog).

Using controls in Microsoft Visual Studio

BoltCatalog

Pair the BoltCatalogSize with the BoltCatalogStandard in LinkedBoltCatalogSize property.

  1. Add BoltCatalogSize and BoltCatalogStandard controls to your form from the toolbox.

  2. Right-click on the size catalog and select properties.

  3. Modify the attributes as shown on the image.​ 

    Tekla structures Open API user interface boltcatalog
  4. Right-click on the standard catalog and select properties.
  5. Modify the attributes as shown on the image. 

    Tekla structures Open API user interface boltcatalog

ComponentCatalog

FOR SYSTEM COMPONENTS IDENTIFIED BY A NUMBER, BOUND VALUES OF CONTROLS TO ATTRIBUTES AND CREATE CLICK-EVENT.

  1. Add ComponentCatalog and a TextBox to your form from the toolbox.

  2. Right-click on the textbox and select properties.

  3. Modify the attributes as shown on the image. 

    Tekla structures Open API user interface Componentcatalog
  4.  See this guide for more information on how to bound values of controls to attributes.

  5. Right-click on the component catalog and select properties.

  6. Modify the attributes as shown on the image. 

    Tekla structures Open API user interface Componentcatalog
  7. Add the click-event to your code: 
    private void componentCatalog1_SelectClicked(object sender, EventArgs e)
    {
        componentCatalog1.SelectedNumber = int.Parse(textBox1.Text);
    }
    private void componentCatalog1_SelectionDone(object sender, EventArgs e)
    {
        SetAttributeValue(textBox1, componentCatalog1.SelectedNumber);
    }

     

FOR PLUGINS / CUSTOM COMPONENTS IDENTIFIED BY THE NAME, BOUND VALUES OF CONTROLS TO ATTRIBUTES AND CREATE CLICK-EVENT.

  1. Add ComponentCatalog and a TextBox to your form from the toolbox.

  2. Right-click on the textbox and select properties.

  3. Modify the attributes as shown on the image. 

    Tekla structures Open API user interface Componentcatalog
  4.  See this guide for more information on how to bound values of controls to attributes.

  5. Right-click on the component catalog and select properties.

  6. Modify the attributes as shown on the image. 

    Tekla structures Open API user interface Componentcatalog
  7. Add the click-event to your code: 
    private void componentCatalog2_SelectClicked(object sender, EventArgs e)
    {
        componentCatalog2.SelectedName = textBox2.Text;
    }
    private void componentCatalog2_SelectionDone(object sender, EventArgs e)
    {
        SetAttributeValue(textBox2, componentCatalog2.SelectedName);
    }

     

Was this helpful?
The feedback you give here is not visible to other users. We use your comments to improve the content.