Handling of Graphic Properties

Graphic elements present usually three interfaces for interaction from the control language. These define the design, the functionality as well as the usability and return user accesses in terms of events. You can react to these events by using the Control language.

  • Properties: Define the design/functions, for example, color, visibility,...

  • Methods: Define the actions of the graphic object, for example, sorting of a table

  • Events: Define outer actions, for example, mouse click, focus receipt,...

You can read most of the properties as well as write them through Control. The principle is similar to that of data point access - the values of properties are mapped to variables. These can be processed in scripts and subsequently passed to graphic properties.

The function for reading graphic properties:

getValue(string shape, string prop, anytype value [,anytype val2..]);

Here you read the value of the graphic property 'prop' of the graphic object 'shape' and pass it to the variable 'value'. If a graphic property possesses two values, you just add a further parameter (for example "scale" or "size").

main()
{
  string col;
  getValue("Border1","backCol", col);
  // Rectangle with the Name
  // 'Border1': Read out the
  // property 'background color'
  DebugN(col);
  // Output in the Log Viewer (string)
}

Alternatively, you can also use the short form according to C++. For an individual property, the syntax with the dot notation of the above getValue() function is equivalent.

col = Border1.backCol;

In order to set a graphic property by means of Control, the inverse command setValue() will be used:

setValue(
string shape, 
string prop, 
anytype value [,an
ytype val2..]);

or

shape.prop = value;

Thereby, the content of the variable 'value' will be passed to the property 'prop' of the graphic object 'shape'. If you access the own graphic object using an EventScript, you can use the short form also here:

  setValue("","prop",val);
    getValue("","prop",val);
    this.prop = val;
    val = this.prop;

The both possibilities are in each case equal to each other. As earlier in case of the data point accesses, you can read and set several properties together in one command when you access graphics. However, the long form with getValue or setValue has to be used here.

 setValue("", "backCol", stringVar1, "text", textVar1);

You can also access several properties of several graphic objects using the functions getMultiValue() and setMultiValue().

However, it is not possible to chain multiple properties for one object with the dot notation. E.g.:

The expressions are not executed and an exception is thrown.

this.text("123").color("green")

What graphic objects and methods of a graphic object can be accessed using CONTROL, is described in the online help chapter Graphic objects. Thereby, there is a number of properties that exist on all objects and other can only be used specific for a particular graphic object.

If a device symbol is composed of numerous individual graphic objects, it is recommended to use an individual script for the dynamization. If the whole range should also respond to mouse clicks, you would expect that you have to add the appropriate script to each of the objects. Instead you can work with invisible click shapes: simply draw a rectangle above the favored range and set both the foreground and background color to "_Transparent". By adding the following row to the initialize script of the object, the script becomes click sensitive and can evaluate user input:

this.fill = "[solid]";