This example shows how to dynamically change properties of graphical elements (not control elements, but e.g. rectangles or, as here, polygons) at runtime and thus use them to display data point values.
This fulfills the desire to use surfaces that are not right-angled and horizontally aligned as display elements, e.g. for the condition of a room.
It is recommended that you place all graphical elements that you want to change dynamically in a separate layer (“Display Elements” in the example project) so that the search for the correct element is done as quickly as possible.
The assignment of the element to a data point is done via the data point name. Since Elvis configuration only allows control elements to enter the data point name, a macro has been created that can also be used to assign data point names to other elements.
– Copy “DPName_setzen.idm” to the Macros\General directory.
– Select the desired item.
– Run the macro (Tools/Run).
– Enter the data point name and click OK to confirm.
Since Elvis only automatically binds controls to data point values at runtime, you must replicate this logic in the operator station’s event processing. In Form_Load, the relevant data point values should be fetched and the elements initialized, in OnDatapointChanged you can react to changes in the actual value.
In the example, the FillStyle property of polygons is set to 0 (not filled) or 1 (filled), depending on the ActualValue.
Download example (zip, 108 KB)