From Friday, January 17th 11 PM CDT (January 18th 5 AM UTC) through Saturday, January 18th 11:30 AM CDT (January 18th 5:30 PM UTC), 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: 

decoration text color, changing programatically

Solved!
Go to solution

Hi,

I have a VI with some text on it (not a string). Is it possible to change the colour of the text programatically?

I can change the colour of the background of the text by using property nodes to  determine its decoration ref, then wiring new colour values to the 'Colors' property.

 

Is a similar apprach possible to set the text color?

 

-i realise i could achieve a similar thing by replacing the FP text boxes with string indicators and wiring property nodes, but would prefer not to have to at this stage!

 

Cheers,

Blue 

 

Message 1 of 6
(4,954 Views)
Solution
Accepted by topic author BlueTwo

Although front panel decoration do not have block diagram icons, it is possible to change some of their properties. If you access the Front Panel decos[] property list, you can return references to each front panel decoration item. However, the list of properties available for these front panel decorations is limited, so identifying your decoration will be difficult.

 

One option would be to cast to a Decoration>Text class, and check the error out. If this results in no error then you know you've found yourself a text decoration. Then, in a No Error case, check the Text property against the decoration you're looking for. If it matches, change the Text Color property.

 

 

 

Of course, remember to close all references (my example is unfinished, but runs ok).
Message Edited by Thoric on 05-14-2009 01:31 PM
Thoric (CLA, CLED, CTD and LabVIEW Champion)


Message 2 of 6
(4,937 Views)

I already have the decoration refs for the decorations i need to change, so it is only the 'class specifier' i need to add. Great!

 

Many thanks,

 

Blue 

Message 3 of 6
(4,932 Views)
While this method works, it is a brittle solution since decorations have no real identifier and their order in the reference list can change as you add and subtract things from the front panel.  You are usually better off using a Classic style Simple String and setting the background color to transparent.  You can then easily get a solid reference to the string.
Message 4 of 6
(4,900 Views)

Yes, after successfully trying out the class identifier route i bit the bullet and re-did the front panel with strings. I guess in the long run it will be a better solution, especially as i have various sub-panels to co-ordinate as well.

Thanks, Blue. 

0 Kudos
Message 5 of 6
(4,886 Views)
There are also user tags of course.
Thoric (CLA, CLED, CTD and LabVIEW Champion)


0 Kudos
Message 6 of 6
(4,870 Views)