HMI Pad Forums Old forum Support (old) Holding Register Color

This topic contains 1 reply, has 1 voice, and was last updated by  Marco 7 years, 11 months ago. This post has been viewed 694 times

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #19935



      In the following code, I would like to change the coulor of the write if the holding resgister is 0 the write must be green, if 1 the write must be red, and if 2 the wreite must be Olive.

      page=”BILGES”; section=”STATUS”; label=”STEERING” ; comment=”Range: 20 to 80 %”; style=lookup; bounds={0,2};color_bounds={0};color=DarkGreen;color_bounds={1}; color=Red; color_bounds={2};color=Olive;

      I see the correct write, but the color is allways the same, DarkGreen…



        Hi Marco, The color_bounds does not work like that, instead you must define an exclusion range for using color. In order to show several colors you have to combine the color_bounds with the tint_color_bounds. This is described on the manual with some examples. Please look at the section describing attributes.

        However, since expressions were added there is a more flexible way that only involves the ‘color’ attribute. You can enter something like this:

        myValue INT HR2 color = (myValue==0 ? “DarkGreen” : (myValue==1 ? “Red” : “Olive”)) ;

        associativity of the ternary operator is right-to-left so you can even omit the parentheses, like this:

        myValue INT HR2 color = myValue==0 ? “DarkGreen” : myValue==1 ? “Red” : “Olive” ;

        I hope this helps.

      Viewing 2 posts - 1 through 2 (of 2 total)

      You must be logged in to reply to this topic.

      Copyright © SweetWilliam, S.L 2009-2013. All rights reserved.
      Science and Technology Park of the University of Girona, Emili Grahit, 91 (NarcĂ­s Monturiol building, Office P3-B03) 17003-Girona. Phone +34972183244