Tekla Open API

Detailed and full API reference helps you master Tekla Open API

This is the most recent version of Tekla Open API.
For older versions, please visit Tekla Warehouse.

FormBaseSetAttributeValue Method

Sets a value for the given control. When the dialog is not shown, setting a property directly for a control (such as textBox1.Text = "text") will not work for controls that have a Tekla Structures AttributeTypeName set. This method is going to have to be used to set the value.

Namespace:  Tekla.Structures.Dialog
Assembly:  Tekla.Structures.Dialog (in Tekla.Structures.Dialog.dll) Version: 2019.0.0.0 (2019.0.0.0)
Syntax
public void SetAttributeValue(
	Control Ctrl,
	Object Value
)

Parameters

Ctrl
Type: System.Windows.FormsControl
The control whose value to set.
Value
Type: SystemObject
The new value. It can be of any primitive datatype supported by the control's AttributeType (normally int, double or string).
Examples
The following example shows how to use SetAttributeValue(Control, Object):
using System;
using System.Windows.Forms;
using Tekla.Structures.Dialog;
using Tekla.Structures.Dialog.UIControls;

public class Example : PluginFormBase
{
       private void MaterialCatalogSelectionDone(object sender, EventArgs e)
       {
           materialTextBox.Text = materialCatalog.SelectedMaterial;
           SetAttributeValue(materialTextBox, materialCatalog.SelectedMaterial);
       }

       private TextBox materialTextBox = new TextBox();
       private MaterialCatalog materialCatalog = new MaterialCatalog();
}
See Also