05-02-2019 02:11 AM
Hi
I have the need to create multiple copy enum constant, in which editing any of them will cause changes to all copies, but each of them retain their own selector value.
I know this can be done by type-def. However there are two disadvantages:
- I have to change the enum constant a control, disrupting the front panel
- The creation of an additional .ctl file complicates version management.
Is it possible to make type-def without making external .ctl file ?
If not, is there any other way to make copies of enum constant ?
Thanks in advance !
05-02-2019 03:12 AM
@2A91312E wrote:
Is it possible to make type-def without making external .ctl file ?
No.
@2A91312E wrote:
If not, is there any other way to make copies of enum constant ?
Put the constant in a VI?
.
This will obviously result in the exact same disadvantages as a type def, and then some.
I removed pretty much every type def control by switching to OO... There's just much less need from them anymore.
05-02-2019 04:41 AM
Maybe you're already aware of this, but:
@2A91312E wrote:- I have to change the enum constant a control, disrupting the front panel
You can place block diagram constants for an enum defined in a type-def .ctl file without requiring a FP control. The enum on the .ctl file will be a Control, but when you place it, you can drag it directly to the block diagram (or to FP, then right click and choose Change to Constant) to add only a BD constant (with no control disrupting the FP).
05-02-2019 05:49 AM
@cbutcher wrote:
Maybe you're already aware of this, but:
@2A91312E wrote:- I have to change the enum constant a control, disrupting the front panel
You can place block diagram constants for an enum defined in a type-def .ctl file without requiring a FP control. The enum on the .ctl file will be a Control, but when you place it, you can drag it directly to the block diagram (or to FP, then right click and choose Change to Constant) to add only a BD constant (with no control disrupting the FP).
Yes, cbutcher is (as always) correct. Here are the steps I use to make all of my Enums (and other TypeDefs, such as for a large Cluster:
Bob Schor
05-02-2019 06:11 AM
I use almost exactly the same process. I'll just add a couple of minor observations on my workflow.
~3b or 4b. This "Control 1.ctl" (or similarly named file) will be by default created at the top level in your project (lvproj) file. This can be annoying, if you're creating it for use in a library (lvlib file). Since libraries can have custom icon borders defined (don't add the 32x32 box here, only the banner...), if you follow this method your icon won't contain that by default. An alternative (only in the case that you want your typedef to be a part of a class or library with a custom icon) is to create the control there (still called "Control 1.ctl", but now a member of the class/library with the class/library icon) and then copy-paste your new control/indicator from step 2 into the new file.
The downside is that this WILL NOT update the control that you copy it from. As a result, you'll need to replace the control or indicator, if you aren't later going to delete it (e.g. in step 7).
7b. When adding it in other places, you can also drag from the project window, or use the Quick-Drop (Ctrl-Space) menu. If you have many ctl files with similar names, this might be less than totally useful, although the quick-drop menu, at least since 2017, does list additional information about the location in the project alongside the name of the item to be dropped.
Don't ask me why "Sound and Vibration" comes up with a search for "awesome"...