11-10-2006 08:12 PM
I’m totally confused in trying to apply colors programmatically to an LED Boolean. Here’s what I observe and don’t understand:
In attached VI, I set the first argument in the COLORS property array to 255 =blue and the second to 255000= green because I want the ON/TRUE state to be green and the OFF/FALSE state to be blue, as described in the COLORS(4) PROPERTY help section as follows:
“If you pass in two elements, this property uses the first element value for the False and True to False states. Similarly, this property uses the second element for the True and False to True states.”
When I run the VI and throw the toggle switch on and off, the LED stays blue all the time. When I right click on the LED and look at its properties, it shows the ON color with a blue square and the OFF color with a green square. More confusing is this: when I reverse the colors in the colors property array so the first argument is 255000/green and the second is 255/blue, I run the VI and the LED turns blue with the toggle ON and green with the toggle OFF, and the properties chart shows both ON and OFF with a blue square.
There’s inconsistency between the Help text, the properties chart, and the action of the VI. Can anyone explain what’s going on here? I’m using LabView 8.20.
11-10-2006 10:56 PM
11-11-2006 12:22 AM
11-11-2006 01:29 PM - edited 11-11-2006 01:29 PM
This boolean color stuff drove me crazy years ago.
The attatched 8.2 example and illustration can help understand what is going on .
I am not sure it all makes sense unless there is some legacy support involved here.
Until Chris made the observation that the second element in the cluster showed up in the Properties page, I would have said the second elment is a mystery.
If you run my example with its default of only two color cluster values defining the colors, you will not see the T to F and F to T.
You can test this by togling Boolena 3 and clickcing on the "boolean.
If you click on the forth element of the color definition array and define a color for all four elements of the array, you will see the T to F and F to T.
All of the above refers to the color of the first element in the cluster. now moving onto Chris' observation re: the properties page.
It appears the the second element in the cluster does define the colors shown in the properties page and that chaging those colors set BOTH elements of the color cluster to the selected color.
This second cluster element behaviour leads me to agree with chris' observation "that seems pretty useless and confusing" !
I try to get this explained.
Ben
Message Edited by Ben on 11-11-2006 01:30 PM
11-11-2006 11:30 PM
11-13-2006 01:22 PM - edited 11-13-2006 01:22 PM
Message Edited by Aristos Queue on 11-13-2006 01:25 PM
11-13-2006 08:04 PM
11-14-2006 01:21 AM
WB,
I do not know hex or other conversions. To avoid confusion, i always use a colorbox constant. It is located in the functions pallatte>programming>graphics and sound>picture functions. this automatically converts the color of choice to a number. So basically wire exactly how Aristos Queue showed in the prevoious post just replace the Numeric controls with color box constants.
Chris
11-14-2006 07:50 AM - edited 11-14-2006 07:50 AM
Colors in LV are represented by a U32 where the three low order bytes represent the color components RGB where the B byte is the lowest order byte and the R byte is the highest order.
The confusion you are seeing is due to the values being shown in decimal while the doc's are refering to hex notation.
The attached VI and image may help illustrate.
Note: the highest order byte (I believe) is used for transparency (I think) but I have never mastered using this bytes.
Ben
Message Edited by Ben on 11-14-2006 07:50 AM
11-14-2006 02:47 PM