From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Changing a property of a string indicator in a cluster with a sub-VI

Solved!
Go to solution

I know the question of updating an indicator on a top-level VI from a sub-VI has been asked before on the discussion board, but my question is slightly different because I want to update the property of an indicator, not necessarily its value. 

 

In my top-level VI I have a cluster which contains some string indicators.  The cluster is a typedef. 

 

Top.jpg 

 

I want to change the background color of the string indicator to red or green from my sub-VI so that it looks like this:

 

Top2.jpg

 

Creating a reference to the cluster and passing it to the sub-VI doesn't seem to work.  I'm not able to see the Text.BGColor property to change the background color of the string indicators:

 

Property.jpg

 

It seems like creating a reference to a string indicator and passing it to the sub-VI might work like this:

 

StringRef.jpg

 

Is there a better/more elegant way to do this? Do I have to create a string reference for each string in my cluster and pass it to my sub-VI?

 

I messed around with global variables, but no luck.

 

Plese help.

0 Kudos
Message 1 of 9
(6,033 Views)

what I think you left out in that question is the step where you take the cluster ref and get the refs to the objects inside the cluster. Since there is more than one and cluster allow different data types, the refs from the cluster ref are generic and the property you are looking for is specific to the strings.

 

So what you need is the "To more specific" node along with a constant ref for a string and you should be good to go.

 

 

I wrote about this idea in my Nugget on Exploiting Control References where I discover at run time the definition of the cluster. Don't worry about reading and understanding everything in that nugget. Just read enough to figure out what need to change in your code.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 2 of 9
(6,023 Views)
Solution
Accepted by Sidd
You have the right idea.  The cluster reference has a property called Controls[].  That returns an array of references to every control in your cluster.  Indexing those will have the BGColor properties you need.
LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019 - Unfortunately now moving back to C#, .NET, Python due to forced change to subscription model by NI. 8^{
Message 3 of 9
(6,018 Views)

Thanks.  Your solutions worked.  Here's the working sub-VI:

 

Solution.png

0 Kudos
Message 4 of 9
(5,996 Views)

Hey,

 

I'd really like to do what you have shown in the 2nd image where you have the Numeric Indicator changing colour dependant on value. I'd like to create a NUmeric Indicator that is green if a value is in spec. or red if it is outside of spec.

 

Please can you tell me in laymans terms how to do this? I'm a somewhat beginner on LabVIEW anyways.

 

Thanks

 

Craig

0 Kudos
Message 5 of 9
(5,231 Views)

@RotoMoto wrote:

Hey,

 

I'd really like to do what you have shown in the 2nd image where you have the Numeric Indicator changing colour dependant on value. I'd like to create a NUmeric Indicator that is green if a value is in spec. or red if it is outside of spec.

 

Please can you tell me in laymans terms how to do this? I'm a somewhat beginner on LabVIEW anyways.

 

Thanks

 

Craig


How about this? Background is green when the number is between 90 and 100, otherwise red.

BGCapture.PNG

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 6 of 9
(5,222 Views)

Looks perfect, thanks, though I'm not sure where I find each of the functions used?

 

Sorry total layman at the moment.

0 Kudos
Message 7 of 9
(5,213 Views)

They are in the functions paletteSmiley Tongue 

I hope you know how to create a numeric control (x) and the numeric constantans 

In Range and Coerce is in Functions--->Comparison

Select is also in Functoins--->Comparison

The Color Box Constant is in Functions--->Dialog and User Interface

The NumText.BGColor Property Node is created y right clicking on the numeric control terminal on the block diagram and from the popup menu select

Create--->Property Node--->Numeric Text--->Colors--->BG Color

Then right click on the Property Node and select Change All To Write

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 8 of 9
(5,183 Views)

That worked perfectly! Thanks a lot.

 

Craig

0 Kudos
Message 9 of 9
(5,165 Views)