GraphicRepeaterApp example
- Last UpdatedJul 16, 2024
- 3 minute read
Preparing the GraphicRepeaterApp to run in a ViewApp includes two major workflows of creating a repeatable graphic and assigning values to the app's properties. This topic provides a quick over view of the major steps in both workflows.
Create a repeatable graphic
The following figure shows a GraphicRepeaterApp running in a pane of a ViewApp. The repeatable graphic is a horizontal bar with a label on the left and the current value of a custom property on the right.

The GraphicRepeaterApp is configured to show graphics horizontally in descending order by the current values of each graphic. There are nine repeatable graphics shown by the app.
This is what the repeatable graphic looks like when it is open in the Industrial Graphic Editor. The graphic consists of two rectangle graphic elements and two text elements.
|
|
|
Width animation is set to custom property Value1for Rectangle9.

Rectangle8 has no assigned animation.
Text11 associates custom property Label1 to Value Display animation.

Text9 associates custom property Value1 to Value Display animation.

The width of the repeatable graphic bar is determined by the current value of its Value1 custom property. A static string will be associated with the Label1 custom property of the Text11 graphic element.
Assign values to GraphicRepeaterApp properties
The next section of the chapter describes the complete procedure to place the GraphicRepeaterApp onto a layout pane, and then assign values to properties.This section summarizes some of the major property configuration steps.
The following figure shows the values assigned to GraphicRepeaterApp properties for this example repeatable graphic.
-
Label1 and Value1 are the custom properties of the HBar graphic.
-
The repeatable graphics will be sorted by the current value of the Value1 custom property.
-
The graphics will be oriented vertically and in descending order.
-
The name of the instance of the GraphicRepeaterApp is GRrepeater_HBar.

Write a layout script
The following example layout script provides values to the Label1 and Value1 custom properties that belong to the HBar repeatable graphic.
The Data property associated with the GRepeater_HBar instance of the GraphicRepeaterApp assigns values to the Label1 and Value1 custom properties in their comma delimited order specified in the Custom Properties property. Label1 is assigned a static string enclosed in double quotation marks. Value 1 is assigned values by object references. The script assigns values to nine instances of the HBar graphic.
MyContent.GRepeater_HBar.Data = " ""Pump1"",PLCSim.Triangle1," +
" ""Pump2"",PLCSim.Triangle2," +
" ""Pump3"",PLCSim.Triangle3," +
" ""Pump4"",PLCSim.Triangle4,"+
" ""Pump5"",PLCSim.Triangle5," +
" ""Pump6"",PLCSim.Triangle6," +
" ""Pump7"",PLCSim.Triangle7," +
" ""Pump8"",PLCSim.Triangle8,"+
" ""Pump9"",PLCSim.Triangle9";
For more detail about layout scripts, see Example layout script with the GraphicRepeaterApp.

