09-21-2017 09:06 AM
LV2013 (moving to 2017 soon). LVRT
I have a TypeDef called "Units".
It's an ENUM, with 40+ values, like "DegC, DegF, kPa, Pa, MPa, etc...
The user sets a given channel to have certain units, units are displayed when they plot that channel, sometimes units are converted for analysis.
As a CONTROL, I want it to match my other controls - 15 pt black normal font. I have maybe 10 instances of that.
As an INDICATOR, I have maybe 30 instances where I want it to be bold yellow italic 15-pt font. Maybe 30 other instances where I want it to be bold yellow italic 20-pt font.
I had all this set up nicely, but now I had to make a change to the location of the typedef, so it broke every instance. When I relink them, they all revert to the master copy.
What I want is a sub-Typedef, where the CTL includes a copy of the original, but changes the font. So each window would use an instance of the original, or an instance of the little yellow one, or the big yellow one, as needed. Then If I changed the list of units, all would follow suit.
But LV2013 will not let me do that. A TypeDef cannot start with another TypeDef.
I want to avoid type conversions, if they cost time. I could cluster a new typedef, but that means bundling / unbundling.
It has to work on RT, since some of the display clusters might be used on RT, simply as connections.
I could live with two or three separate TypeDefs, if i could easily copy the list of items from one to another.
Any ideas?
Blog for (mostly LabVIEW) programmers: Tips And Tricks
Solved! Go to Solution.
09-21-2017 09:29 AM
Are you using strict typedef?
09-21-2017 09:36 AM
Strict typedef doesn't make sense here because he wants them to appear differently in some locations.
09-21-2017 09:42 AM
I use a NON STRICT Typedef now, because the font is black 15 here, and yellow 20 there.
I'm open to other ideas.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
09-21-2017 09:56 AM
> the font is black 15 here, and yellow 20 there.
Split to 2 typedef.
09-21-2017 10:02 AM
It's possible to set enum strings programmatically.
09-21-2017 10:07 AM
As Zou said, make it two strict type defs, one with the 15 pt the other yellow 20 pt? Not sure why that wouldn't work. You will have to find all instances and replace them to match the need, but that should be fairly quick.
@zou wrote:
> the font is black 15 here, and yellow 20 there.
Split to 2 typedef.
09-21-2017 10:17 AM
Would an XControl work? Your typedef enum would be the data and you could write the code that sets the color of each instance based on whether it is a control or an indicator. Seems do-able although I'm not sure how to do it.
09-21-2017 10:22 AM - edited 09-21-2017 10:22 AM
Split to 2 typedef.
Yes, but then if I change the items in the master copy, I have to manually make the same changes in the items for the two slave copies.
I was hoping to avoid that.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
09-21-2017 10:29 AM
It's possible to set enum strings programmatically.
Did you check that with an error dialog.
When I try, I get "Writable only when in edit mode" errors.
Oh, I get it - you have to do the operation on SOME OTHER VI, not on yourself.
OK, If I can make that work on a CTL file, then I could:
1... Make changes to the master CTL (strict)
2...Run the above to copy the strings from the master to the new CTL, which is yellow or whatever.
Blog for (mostly LabVIEW) programmers: Tips And Tricks