Configuration
The data grid can be configured as follows to display a one-dimensional array:
- Add a data grid to the interface.
- Link the one-dimensional array with the attribute "SrcData" of the category "Data".
- Change the column settings for the "SrcColumns" attribute in the "Data" category using the Column Definitions dialog.
- Remove the default columns.
- Add a new column of type "SimpleColumnDefinition".
- The column can then be configured.
For an array of a structure, you can proceed as follows:
- Add a data grid to the interface.
- Link the desired array with the attribute "SrcData" of the category "Data".
- Change the column settings for the "SrcColumns" attribute in the "Data" category using the Column Definitions dialog.
- Define the desired number of columns of type "ColumnDefinitnion" and their order.
- Adjust the settings of each column; the "Name" attribute must correspond to the name of the structure element of the array that is to be displayed in this column.
The definition of the "Name" attribute is case-sensitive.
For nested structures, you can use "::" as a separator to access the sub-elements of the structure, for example, "myStruct::myStructMember".
In order for changes in the data grid to be written back to the controller, the following steps must be performed:
- Go to the Events page of the Properties window.
- Configure the ".onDataChanged" event.
- Add a "WriteToSymbol" action.
- Link the first parameter to your array.
- Link the second parameter with the attribute "TcHmiDatagrid::SrcData".
Sample: Datagrid