LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Control color using calculated value

I don't know if the following behaviour is correct or not.
 
If I want to set a color, I can use a color box constant, a color box control, or a numeric value. Now if I calculate the value, it does not work.
Have a look at the attached vi. There are three different ways to set the color of a color box indicator and a portion of text in a text indicator:
1. A numeric (U32) control => this works
2. A color box control => this works
3. A calculated value: (U32)(RoundToNearest(Max(U32) * RandomValue)) => this does not work
 
Are there any explanations for this?
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
Message 1 of 4
(3,626 Views)
Hi Thomas,
the color is saved as a 24-bit value, LV seem to decide to do nothing if the value is greater than 0xFFFFFF. If you multiply the random value with this value (decimal 16777215) it works. There is another way if you use the "RGB to Color.vi" from the Graphic&Sound/Picture Functions palette.
Greets, Dave
Greets, Dave
Message 2 of 4
(3,624 Views)
P.S. the 25th bit is used for transparency, in some cases...
Greets
Greets, Dave
Message 3 of 4
(3,623 Views)
Gosh! Now as you write it, this is logical. If I had taken just one minute to think about, I should have known it...
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 4 of 4
(3,617 Views)