LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

panel background color and control label background color

If I change a panel's background color, is there an easy way to also change the background color for all of the control labels contained in that panel? I have lots of controls in various panels. The background color for the control labels do not change when I change the panel background color, which is a problem. Other than programatically changing all of the control label colors individually to match my panel background color, is there perhaps an easier and faster way to accomplish this ?? If not, then how about adding a checkbox to do this in CVI 2015 ??
Thanks,
Harald.

 

0 Kudos
Message 1 of 5
(5,858 Views)

Hello Harald!

 

Unfortunately, LabWindows/CVI doesn't provide an automatic way of creating controls with user-specified colors. The controls are created by default using default system colors. Users have to either manually or programmatically change the color of each individual control. Note that the "Conform to System Colors" panel attribute sets the control style of each control to the system style.

 

On the other hand, the good news is that you can use control arrays to perform batch operations on multiple controls, from one single function call.

Using control arrays you could set the ATTR_LABEL_BGCOLOR attribute of all controls at once, to easily change the label background color of multiple controls. Here is a reference document for this concept:

http://zone.ni.com/reference/en-XX/help/370051V-01/cvi/uiref/programming_with_control_arrays/

 

Best regards,

- Johannes

0 Kudos
Message 2 of 5
(5,838 Views)

Danke Johannes,
I am already using control arrays in my application, but did not think of using them in this manner, gute Idee !!
Gruesse von San Diego,
Harald.

0 Kudos
Message 3 of 5
(5,830 Views)

Since you'll have to change the background color of all your labels, you might want to change the color to VAL_TRANSPARENT, so that they are no longer affected by future changes in the panel background color.

 

Also, if all your controls come from .uir files, you can change them just once in the UI Editor, instead of programmatically, if you prefer. To do that, group-select all of the controls that have labels (and only the controls with labels, otherwise the attribute you want to change won't show up). Then, type "label background color" in the attribute browser in Filter or Find box of the Attribute Browser at the right edge of the editor to change the color:

 

color.png

Message 4 of 5
(5,786 Views)

Great idea, Thanks !

0 Kudos
Message 5 of 5
(5,780 Views)