LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

changing color of a numeric control through property node

How can we programatically change the background color of numeric control or indicator through property node. I can't find any background color property in its property node.
0 Kudos
Message 1 of 7
(5,731 Views)
Try the NumText.BGColor property.  I think that may work.
0 Kudos
Message 2 of 7
(5,728 Views)
Thanks! Its working!
0 Kudos
Message 3 of 7
(5,717 Views)

John,

Your solution works if you have a direct reference to an numeric control and wire it to a property node. 

What I'm trying to do is selecting a specific control programmatically using the control name (one of the numeric controls on the frontpanel), and if it's value is less then 0, change it's color to red (for example).

Don't look too much at the part at the top of the block diagram but more to the lower right corner (where the wire is broken).  I'm coming in with an array of controls, find the one that is named "..." and put a value in it.  This is all the upper (pink) part does.

As you can see, i'm ending with a 'Ctr' and this control has only color funcions for the label and the caption and not for the data.  I tried a few things (like realy specifying a numerical, as shown), looking in the invoke nodes, ... but I can't find and BG color for the text.

 

 

0 Kudos
Message 4 of 7
(5,596 Views)
Your class specifier must be Digital (Numeric is to gerneral), then use the property node (not Invoke node).

Felix
0 Kudos
Message 5 of 7
(5,591 Views)
Further to what Felix mentionned, you also have to be careful which controls you are dealing with.  For instance, what works for Modern string controls may not with with Classic or System string controls.  Since they all have the same class ID, I don't know how you could filter against them 😞   See image below.
 
This is for a generic vi that would color the background of a control, right?  To be part of your (or co.) library, right?
 
RayR
 


Top is Modern

Middle is System

Bottom is Classic

All String controls.  The Modern & Classic string controls can have their background (text) color changed by the Property Node.  Not the System (don't know why 😞 )..

Although there is a property available for the System String control, you cannot change the BG color property at run-time (you can try and will get an error message) 😉

 



Message Edited by JoeLabView on 01-11-2008 08:44 AM
Message 6 of 7
(5,585 Views)
The Type Descriptor let you distinguish between modern and System Control.
You really should do that checking instead of catching the errors, some time ago I had 'great' system crashes when using System controls with units...
The disadvantage of the type descriptor is, that it changed between LV versions...

Felix
0 Kudos
Message 7 of 7
(5,575 Views)