Facility Control

 View Only
  • 1.  Dashboard simple countdown color

    Posted 12-28-2018 12:55
    I am trying to build a simple countdown time to countdown our show.. but when time is under 30sek I would like the background color to change at the time widget, is and how Is that possible ???


  • 2.  RE: Dashboard simple countdown color

    Posted 01-02-2019 14:56

    To change the colour of a timer, you just need to call ogscript.setStyle on the label that is being used for display. Here is an example of a timer that changes from green to red when it goes from positive to negative.

    The important code is in the timer's task where we check the current value and set the colour accordingly.

    <abs contexttype="opengear" style="">
       <meta>
          <params>
             <param access="1" maxlength="0" name="game-timer-display" oid="gametimerdisplay" stateless="true" type="STRING" value="00:00" widget="label"/>
          </params>
       </meta>
       <timer autostart="false" id="game-timer" pattern="mm:ss" rate="500" start="00:05" stop="-00:05">
          <timertask tasktype="ogparamset">params.setValue('gametimerdisplay', 0, event.getDisplay());
    if (event.getCurrentValue() &gt; 0)
    {
       ogscript.setStyle('timer-display', 'fg#00FF00');
    }
    else if (event.getCurrentValue() &lt;= 0)
    {
       ogscript.setStyle('timer-display', 'fg#FF0000');
    }
    </timertask>
       </timer>
       <param expand="true" height="104" id="timer-display" left="17" oid="gametimerdisplay" style="style:timerLabel;" top="20" width="443"/>
       <button buttontype="push" height="94" left="467" name="Start/Pause" top="23" width="125">
          <task tasktype="ogscript">var timer = ogscript.getTimerManager().getTimer("game-timer");
    if (!timer.isRunning())
    {
       timer.startTimer(false);
    }
    else
    {
       timer.stopTimer(false);
    }
    </task>
       </button>
       
       
    </abs>

    #DashBoard


  • 3.  RE: Dashboard simple countdown color

    Posted 01-05-2019 18:51
    Thanks is works ðŸ‘
    #DashBoard