Click or drag to resize

Data of RAPID data and I/O signals

What is databinding?

Databinding is the process of binding a property of a GUI control to a data source, so that the property automatically reflects the value of the data source. In .NET CF 2.0 this functionality was simplified with the BindingSource class. This class encapsulates the complexity related to setting up and managing databinding. It allows you to connect a RapidDataBindingSource or a SignalBindingSource to a GUI control without having to write a single line of code. (Except theDispose call when the binding sources are no longer needed.)

FlexPendant SDK classes to be used as binding sources

In the FlexPendant SDK there are two classes that inherit .NET BindingSource : RapidDataBindingSource and SignalBindingSource. These classes enable binding to RAPID data and I/O signals respectively. They belong to the ABB.Robotics.DataBinding namespace and the assembly you need to reference is ABB.Robotics.DataBinding.dll.

RapidDataBindingSource

By using RapidDataBindingSource an automatic update of the bound GUI control takes place when the value of the specified RAPID data source in the controller has changed, or when the control is repainted.

SignalBindingSource

By using SignalBindingSource an automatic update of the bound GUI control takes place when the value of the specified I/O signal in the controller has changed, or when the control is repainted.

Note Note

It is only possible to use persistent RAPID data (PERS) as data source.

Note Note

If you want to let users modify RAPID data, launching the standard FlexPendant application Program Data from your application is probably the best alternative. For more information, see Using standard dialog box to modify data.

GUI example

Many different controls can be used with binding sources, for example TpsLabel, TextBox,ListView and so on. The following screenshot shows two System.Windows.Forms.DataGrid controls that each bind to several objects defined in a RapidDataBindingSource and a SignalBindingSource. The labels in each GroupBox are bound to the same sources. As you see the grid displays all objects defined in the BindingSource control control, whereas each label displays the currently selected grid row.

When a signal or a data value changes this GUI is automatically updated with the new value. You do not have to write any code make this happen, as setting up subscriptions and updating the user interface is done by the underlying implementation.

data 1
Caution note Caution

To avoid any memory leaks an explicit call to the Dispose method of BindingSource controls must be made. However, the wrapper-objects SignalObject and RapidDataObject created for you are disposed of under the hood, so you do not need to worry about it.

How to use the Visual Studio designer for

This section explains how to create the FlexPendant view shown in the previous section. First a RapidDataBindingSource control with bindings to specified RAPID data is created. Then the DataBindings property of a TpsLabel is used to bind the label to the binding source. Finally a standard .NET DataGrid is bound to the same binding source.

Step

Action

1

Start by dragging a RapidDataBindingSource from the Toolbox to the Designer. It will be placed in the Components pane under the form. Open the Properties window and select the RapidDataList property to add the RAPID data you are interested in. For each new RapidDataObject member you must specify module name, task name and name of the persistent RAPID data to bind.

data 2

2

The next step is to open the Properties window for the label that is to display the value of the RAPID data. Expand the DataBindings node and select Advanced.

data 3

3

In the Advanced Binding dialog box that appears, choose the already created RapidDataBindingSource in the Binding combo box, at the same time specifying which one of the RapidDataObject properties you want to bind to, in this caseValue. (The other properties available are variable name, task name and module name, as can be seen in the figure in step 1.) You also select your preferred Data Source Update Mode , usually OnPropertyChanged. The yellow marking in the list to the left shows that the binding has been done to the Text property of the label. When a control has been bound to a data source you will see the same yellow marking in its Properties window, at the bound property. For more information, see illustration on step 2.

6.3.14 4 Advanced Binding
Note Note
If a label has been bound to a data source with several member objects, the first one in the list is the one by default displayed by the label. If the selected index of the list changes (if you select a row in the grid for example) the label is updated automatically to show the value of the selected index. For more information, see the illustration in Data of RAPID data and I/O signals.

4

Now launch the Properties window of the DataGrid control. Set ColumnHeaderVisible to true and select your data source at the DataSource property.

data 5
Note Note
The DataGrid control displays only one row in design-time (For more information, see the illustration of step 1). In run-time, however, the entire collection of RapidDataObject members is displayed (see the figure in Data of RAPID data and I/O signals).
SuspendBinding/ResumeBinding

SuspendBinding() and ResumeBinding()have extended functionality compared to the methods of the inherited BindingSource class. Removing/adding subscriptions have been added, as subscribing to signals and RAPID data can be resource consuming. These methods can be used in the Deactivate/Activate methods, which are executed each time you switch back and forth between different applications using the FlexPendant task bar. For more information, see Application Framework usage - ITpsViewActivation.

If you suspend the binding you no longer get any updates if the data source is changed. However, the binding still exists, so if DataSourceUpdateMode is set to OnValidation the value will be updated when you repaint the control, as the value from the controller will be read before it is repainted.

Method

Description

SuspendBinding

Suspends the binding and value change event.

ResumeBinding

Resumes the binding and value change event.