Assign custom property values of a graphic
- Last UpdatedJun 02, 2025
- 2 minute read
Custom properties of a graphic can be set to values when a graphic is shown by ShowGraphic() containing the CustomProperties property.
The parameters of CustomProperties are the custom property name, assigned value, and the IsConstant Boolean flag that indicates if the custom property value is a constant. Any parameter that has default value in the GraphicInfo is optional. If no input value is specified for these parameters, the default values are used at run time. Any parameter except the Enum data type can be a constant, reference, or expression. When you use the Object Browser to select and automatically insert an object in the script, the script editor adds double quotes around the object name. If you add the object name manually, be sure to enclose it in double quotes.
These parameters are specified as an array of values using the CustomPropertyValuePair[] array. The array index starts at 1.
If an attribute name is not enclosed in double quotes while assigning it to a custom property with the CustomPropertyValuePair[] array, the quality of the attribute will not be picked up by the custom property.
Use a script similar to the following to assign values to a graphic’s custom properties. In this example, "i1" is string Identity and the graphic "S1" contains custom properties CP1 and CP2. When S1 is shown during run time, CP1 is assigned a constant value of 20 and CP2 is assigned the current value of the reference Pump.PV.Tagname.
Dim graphicInfo as aaGraphic.GraphicInfo;
Dim cpValues [2] as aaGraphic.CustomPropertyValuePair;
cpValues[1] = new
aaGraphic.CustomPropertyValuePair("CP1", 20, true);
cpValues[2] = new
aaGraphic.CustomPropertyValuePair("CP2", "Pump.PV.TagName", false);
graphicInfo.Identity = "i1";
graphicInfo.GraphicName = "S1";
graphicInfo.OwningObject = "UserDefined_001";
graphicInfo.WindowTitle = "Graphic01";
graphicInfo.Resizable = false;
graphicInfo.CustomProperties=cpValues;
ShowGraphic( graphicInfo );