Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

State colors

drChiavo
2015-11-26
2015-12-06
  • drChiavo

    drChiavo - 2015-11-26

    Hello,

    I'm doing a visualization and I want to know, if it is possible to have three state colors for an object? For example, if I have a button and I want to change the color three times. I have just seen that there are just two state "Normal State and Alarm state". Is there another way to add an additional state?

    Attached an example of my three states.
    thanks

    IMG: Display.PNG

     
  • t.lundahl

    t.lundahl - 2015-11-27

    Hi,

    I did this in version 2. You need to use your own variable (DINT i think it is).

    And under ColorVariable (Expert Mode) you can add the variable you need for normal state and alarmstate. And you change the colorcode to the variable by code instead.

    IMG: ColorProperties.PNG

     
  • drChiavo

    drChiavo - 2015-11-27

    Hello,

    thanks for your answer but I already knew this two states (Normal and Alarm states). Do you know if there is any possibility to add an additional state?

     
  • t.lundahl

    t.lundahl - 2015-11-27

    This is not the same because you add a variable to the normal state and then you change the color by changing the content of this variable in your code.

    For example:

    IF ThisState THEN
    ColorVariable := 16#FF FF 00; (RGB if I remeber correct R=255 G=255 B=0)
    ELSIF AlarmState THEN
    ColorVariable := 16#00 FF 00;
    ELSIF OtherState THEN
    ColorVariable := 16#00 00 FF;
    ELSE
    ColorVariable := 16#00 00 00;
    END_IF;

     
  • asi

    asi - 2015-12-06

    Hello!

    Is there a known bug in V3 concerning colorvariables?

    I tried a DWORD ("16#FF0000" (red)) in "Fill Color" but it only changes to white after running the visu.
    If I leave the field blank it gets its "Normal state" color like it should.

    I really would like to use this features.... toggling between normal and alarm state is not an option for me.

    Can anyone help?

    Thanks!

    I am using the latest V3.5 SP7 Patch3

     
  • eschwellinger

    eschwellinger - 2015-12-06

    Hi,

    since semi transparence was introduced(guess 3.5SP6):

    Color variables
    Applied for dynamic definitions for the color of the element via a project variable.
    A color is defined by a hex number which is composed of Red/Green/Blue (RGB) components.
    A project variable of type DWORD must be entered like prog1.dwFillColor.
    The variable must define the color value in hexadecimal format.

    To fill the complete DWORD, the first two digits after "16#" have to be set to zero: "16#00RRGGBB".

    HIND to the first two digits:
    00 is used when under Visualization Manager > Activate semi-transparent drawing is NOT active
    FF, instead of 00, is used when under Visualization Manager > Activate semi-transparent drawing is active

    This is missing in the onlinehelp, there is an open point in our tracking system.
    BR
    Edwin

    IMG: Colors.jpg

    IMG: semi.jpg

     

Log in to post a comment.