"styleSheet"

Allows to define a custom style for separate widgets or panels to individually adapt them. These styles override the general stylesheet settings.

Synopsis

setValue(string shape, "styleSheet", string style);

getValue(string shape, "styleSheet", string &style);

shape.styleSheet(string style);

Parameter

Parameter Description
shape Name of the object / panel
style Style that should be applied. For more information on the available options see Style Sheets, basics

Description

Allows to set the style of an object by using a script. Can also be applied to a panel where the style is used for the contained objects, if applicable.

Setting the styleSheet property will override the global style settings made inside of the stylesheet.css file of WinCC OA. Setting the property for an object will also override the settings made for the panel.

Example

Following example demonstrates how specific style settings are made using the styleSheet property. The code below sets either the color of a button or the color of all buttons within the panel to red, depending on wether the code is called from within a panel or a specific button.

main()
{
  string myStyle = "QPushButton { color: red }";
  this.styleSheet(myStyle);
}

Assignment

All graphical objects