Color Change


svego

Recommended Posts

Hi,

 

simple question but I didn't find answer...

 

How can I change LED symbol to be green if digital input_1 is true, and red when is false... ?

 

example

 

component name is: LED_channel_1

active color is green

inactive color is red

 

THX

Link to comment
Share on other sites

well, both examples please....

 

LED component, right click -> Displays -> LED round....

 

or

how to change color on button eg from gray to green ( relay on/off)  ???

 

also picture

 

how to change c:\picture1.gif  ( channel1=0 )    to c:\picture2.gif if  channel1=1

Link to comment
Share on other sites

You can change the color of the LED component for off/on by simply clicking on the active color or inactive color boxes in the components properties.  Active is when the expression evaluates to non-zero, inactive when it evaluates to zero.

 

A button is a little trickier, here you would have to name the button (select, the right click and select Component Name...), then, probably in the Event for the relay channel, put:

 

component.myButton.backColor = iif(relayChannel[0], RGB(0,255,0), RGB(255,0,0))

 

That will set the background color of the button to green if relayChannel is non-zero and red if zero.

 

As for the picture, use the symbol component.  Create two rows in the symbol component, one with threshold = 0, the other with threshold = 1.  Then paste the appropriate picture for each.

Link to comment
Share on other sites

Hi,

THX, it works..but 3rd option is not working as you suggested..( using custom picture, like digital1=red_polygon.jpeg else  blue_polygon.jpeg

 

 

right click -> display -> Symbol....

 

tried to copy-paste bitmap, jpeg but nothing happened

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.