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,589 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,572 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,567 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,535 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,521 Views)
There are also user tags of course.
Thoric (CLA, CLED, CTD and LabVIEW Champion)


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