User interface controls
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:
-
Open the Form1.cs[Design] tab.
-
On the Toolbox tab, right- click General and select Choose Items.
-
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.
-
Add BoltCatalogSize and BoltCatalogStandard controls to your form from the toolbox.
-
Right-click on the size catalog and select properties.
-
Modify the attributes as shown on the image.
- Right-click on the standard catalog and select properties.
-
Modify the attributes as shown on the image.
ComponentCatalog
FOR SYSTEM COMPONENTS IDENTIFIED BY A NUMBER, BOUND VALUES OF CONTROLS TO ATTRIBUTES AND CREATE CLICK-EVENT.
-
Add ComponentCatalog and a TextBox to your form from the toolbox.
-
Right-click on the textbox and select properties.
-
Modify the attributes as shown on the image.
-
See this guide for more information on how to bound values of controls to attributes.
-
Right-click on the component catalog and select properties.
-
Modify the attributes as shown on the image.
- 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.
-
Add ComponentCatalog and a TextBox to your form from the toolbox.
-
Right-click on the textbox and select properties.
-
Modify the attributes as shown on the image.
-
See this guide for more information on how to bound values of controls to attributes.
-
Right-click on the component catalog and select properties.
-
Modify the attributes as shown on the image.
- 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); }