PlantScada - Startup/Timing issue for Theme_SetHilightColor when using custom theme

Hi,

In my startup script I've added following two lines for custom Theme setup:

//Project Theme settings
Theme_SetHeaderColor(5, 0); 
Theme_SetHilightColor(5, 1); 

Custom Theme 5 is set at "Standards ->Labels: _THEME_Default ->Expression = 5

It looks like there might be an timing issue with my startup script and the execution of FUNCTION Theme_SetTheme (INT nTheme) that again execute DspSetCurColor. 

1-2 runtime starts of 10, the array value for Theme_SetHilightColor is not set when function DspSetCurColor is executed, hence highlight color defaults to 0 and not my custom color 1. 

Appreciate any input,

Thanks

Rune

 

Parents
  • Thanks Jacky,

    I've also found two workaround that seems to work. At least when using either of these in my start-up script I haven't been able to reproduce the issue. 

    Alternative1:

     //Project Theme settings
    Theme_SetHeaderColor(5, 0);
    Theme_SetHilightColor(5, 1); 
    SleepMS(0);
    Theme_SetTheme(5);

    Alternative2:

     //Project Theme settings
    Theme_SetHeaderColor(5, 0);
    Theme_SetHilightColor(5, 1); 

    Theme_SetTheme(5);

  • Gald to hear that you have found workarounds, Rune. In general, the internal start-up sequence should be compeleted before executing the user start-up code. Theme_SetTheme(_THEME_Default = 5) is actually called in the internal startup code. Maybe calling Theme_SetTheme(5) again after setting Header and Highlight colours in your startup code fixes the problem. Having a sleep is also good approach to ensure your code will be executed after completion of the internal start-up sequence.

Reply
  • Gald to hear that you have found workarounds, Rune. In general, the internal start-up sequence should be compeleted before executing the user start-up code. Theme_SetTheme(_THEME_Default = 5) is actually called in the internal startup code. Maybe calling Theme_SetTheme(5) again after setting Header and Highlight colours in your startup code fixes the problem. Having a sleep is also good approach to ensure your code will be executed after completion of the internal start-up sequence.

Children