05-23-2014 09:48 AM
Open the xcontrol example with the thermometer (search the example finder). An Xcontrol is a controls with a defined datatype (e.g U16 in your case) but what the user sees can be anything (e.g. 3 small numeric control for RGB and a colorbox showing the resulting color in your case) and the look can depend on if we use it as control or indicator. It contains all the math to converts whetever the users sees or operates (can be anything!) to the U16 datatype and back. Once you create the xcontrol, you can use it like a regular control. It even reacts correctly when the parent Vi is in edit mode.
05-24-2014 11:11 AM - edited 05-24-2014 11:11 AM
This would be less Rube Goldberg code.
05-24-2014 11:38 AM - edited 05-24-2014 11:39 AM
Rolf's snippet is a far cleaner bit manipulation then was I was talking out in my message. Taking that and adding Altenbach's suggestion of showing the actual resulting color that gets encoded in the 16 bits, I get this.
05-26-2014 03:56 AM
Thank you for pointing out on my Rube Goldberg code 🙂
I implemented RavensFan's solution, but it does not work for white and colours close to white (grey), see screenshot, please.
Below is the code, please.
Additional questions:
* How do I make LabView display the zeros at the begining of the binary number? The number constant in question is labeled "bits accepted for U16" in my code, no label in RavensFan code.
* Again, how do I make LabView display all the characters (zeros) in the hexadecimal number? That is, in both and only hexadecimal numbers in the code "U32 Colour Number In" and "U32 Colour Number Out").
05-26-2014 04:20 AM - edited 05-26-2014 04:22 AM
Ok, so I found the answer to show the whole binary number: in the display properties to the constant, there is the option to pad wioth zeros from the left. The same is applicable for th hex-strings.
05-26-2014 04:30 AM
The color you show as white is not an RGB code but a special LabVIEW code. Notice the most significant bit bit 24 (25th bit) being set to 1. With that bit set the lower significnt 16 bits are really just an index into the LabVIEW predefined colors for things like dialog background, highlight color, etc. Which also depend on your currently selected platform GUI theme. I believe 0x1000000 is transparent, which for various reasons can't be everywhere used such as for fill colors in most objects, since it is not possible to draw transparent, but instead requires the draw algorithme to inverse the normal draw logic in many situations.
06-11-2014 10:05 AM - edited 06-11-2014 10:18 AM
In my Message 14, the output is falsely assigned in the attached VI. This was the reason for false output. Thank you all!
Edit: No, it was is not the only error. I do not understand: the white colour is still as black at the U16 output.
06-11-2014 10:57 AM
As Rolf said, you picked a "special" color. A u32 that maps to the windows system settings color. It isn't white, it is "Panel & Object" that would be selected from the System section of the lower right part of the Color Picker dialog box. Once you strip off the highend byte (the one before the RGB), you are left with something closer to black.
You need to pick your white of the regular "User" colors, or using the Palette button that let's you pick a custom color out of the color dialog box.
06-12-2014 09:25 AM
Thank you RavensFan for pointing me to the right direction -- I think, I was (still) lost in translation when reading Rolf's explanaition for the third time.
I've found only another single post, where the user was also mislead by a system color http://forums.ni.com/t5/LabVIEW/System-colors-do-not-give-correct-RGB-values/m-p/868863/highlight/tr...
Would it make any sense, if I wished for a colorbox, which would state a non-standard color? E.g. by drawing a giant "S" in the box, similar to "T" for transparent. <- That's a hypotetical question. I am thinking of posting a LabVIEW Idea post about it.
06-12-2014 09:47 AM
There might be some value in having a color box for a system color indicate that in some manner. I don't think the "S" would work because if the text was black (like the Transpare "T"), it would show up for a system white, but disappear in a system black or other dark color.