LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using a TypeDef from a TypeDef

Solved!
Go to solution

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?

 

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 1 of 20
(4,188 Views)

Are you using strict typedef?

 

George Zou
0 Kudos
Message 2 of 20
(4,175 Views)

Strict typedef doesn't make sense here because he wants them to appear differently in some locations. 

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 3 of 20
(4,169 Views)

I use a NON STRICT Typedef now, because the font is black 15 here, and yellow 20 there.

I'm open to other ideas.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 4 of 20
(4,161 Views)

the font is black 15 here, and yellow 20 there.

Split to 2 typedef.

 

George Zou
0 Kudos
Message 5 of 20
(4,151 Views)

It's possible to set enum strings programmatically.

 

set_enum_strings.png

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 6 of 20
(4,140 Views)

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.

 


 

Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 7 of 20
(4,128 Views)

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.

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
Message 8 of 20
(4,121 Views)

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.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 9 of 20
(4,118 Views)

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.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 10 of 20
(4,112 Views)