Skip to main content

SetControlBackColor

Valid for: CANoe DE • CANoe4SW DE

Function Syntax

void SetControlBackColor(char[] panel, char[] control, long color);

Description

Sets the background color of: certain panel controls The panel is accessed by its individual panel name that is entered in the Panel Designer.

Parameters

  • panel: Panel name, restricted to 128 characters. "" – references all loaded panels.
  • control: Name of the control, restricted to 128 characters. You can only activate/deactivate the control with its name. In the property dialog of the control, its name is assigned/displayed. If you want to use the name of a symbol (signal or system variable) you have to ensure that the control has no name instead of the individual control’s name. The name of the system variable or signal could be specified as following.
    • The form for signals is: "Signal:<signal name>".
    • The form for system variables is: "SysVar:<name of system variable>". The namespace must not be used.
    Note: Symbol assignment is not case sensitive. If you want to access all elements of a panel the notation "" is used, see example below. Example:
    • "Signal:SleepInd"
    • "Signal:easy/MotorState/EngineSpeed"
    • "SysVar:SysVarTester" (for a system variable defined with namespace TestSysvar in the configuration)
    Note for ‘CAPL Output View’ Control: When changing the background color only the following/future output — using putValueToControl — is colored with the new one. The existing output stays unchanged in color.
  • color: Color value (e.g. calculated by makeRGB) Note makeRGB:
    • Up to and including CANoe DE product version 12.0 SP2, the function makeRGB returned the blue value in the second byte and the red value in the fourth byte. Functions that received this value as a parameter interpreted this exchange so that the color was displayed correctly.
    • From CANoe DE product 12.0 SP3, the function makeRGB returns the color values in the correct order. Functions that have received this value as a parameter have also been adjusted to display the correct color again.
    • Existing programs only need to be adapted if you have not used the function makeRGB but you have passed the color hard coded.

Return Values

Example

// Set the background color for a specific control of a panel
SetControlBackColor("motor", "PedalPos", MakeRGB(255,0,0));

// All controls of the panel are set to the same background color
SetControlBackColor("motor", "", MakeRGB(255,0,0));

// All controls of all panels are set to the same background color
SetControlBackColor("", "", MakeRGB(255,0,0));
SetControlPropertySetControlForeColorSetControlColorsSetDefaultControlColors