03-03-2009 09:33 AM
Hello,
to make code more elegant and sensible, I source code often called out to a SubVi. This SubVi is a case structure. If I add afterwards new cases to this SubVi, I have to renew all Enum selectors for the SubVi calls by hand. This is really annoying.
Is there any way to couple the selector to the SubVi so that a change in the number of cases will affect all the selectors automatically?
Best regards
Carsten
Solved! Go to Solution.
03-03-2009 09:41 AM
Yes. You want to use type definitions.
Take one of your enum constants and turn it into a control. Do an Advanced/Customize on the control. From the toolbar at the top of the Control editor, select TypeDef rather than control. (TypeDef (Strict) is okay also.).
Save the control with a filename.ctl extension.
Go back and turn that control back into a constant.
Replace all constants wherever used, with the typedef'ed version of the constant. Edit the SubVI so the Enum control that you use in the connector pane is also the TypeDef control.
Now whenever you update your subVI, you can add a new item to the Enum control and resave the control. Everywhere that control is used (including the constants) will have the new item automatically added.
03-03-2009 10:35 AM
Thank you very much. This works just perfect.
Carsten
03-03-2009 10:06 PM
Please mark Ravens Fan's post as a solution to your problem. So that in future those who are facing the same problem will get benefitted by the solution.
Thanks,
Mathan