LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I establish an enum typedef for use with state machines and action engines?

Hey all--

I have an action engine with several instances.  Any time that I add a method to the engine, I have to modify all of the calling code to update the constant that determines the method being called.  There must be a smarter way to address this problem but my LV experience is insufficient to identify it.  Can any of you wiz-bangs tell me if it is possible to make a type def (I can do this) and use it with each instance of the action engine call so that changing any instance also updates the typedef?

Thanks.
0 Kudos
Message 1 of 4
(3,117 Views)
I am not positive that I know what you are asking, but I will take a stab.  If you are referring to the enum ctrl, and want to be able to add states to it and have the additions automatically propagate through the VI, you can use a strict type def.  If you then turn the control into a constant 9after saving), you can copy the constant for each state case.  If you need to add a case, open the strict type deffed ctrl, change and save.  All of your constants will update to the new ctrl values.
Jim

LV 2020
0 Kudos
Message 2 of 4
(3,113 Views)

Take your enumerator.  If it is not a control (ie constant), change it to a control.

Under File Menu, select New > Custom Control.

Move (or copy) your Enum Control to the Custom Control.  Change the Control to Strict Type Def (the selection to the right of the wrench).  Save it.

(EDIT: ** OOps, the picture shows the wrong one.. sorry**)

Copy that new Strict Type Def control to your code.

See images below.

OR.. If you're using LV8.x, and using a project, I would recomment that you do it from within your project explorer.  Simply insert a new "Control".  The rest of the steps are similar, except that you can insert it from your project. 

R



Message Edited by JoeLabView on 07-08-2008 06:47 PM
0 Kudos
Message 3 of 4
(3,108 Views)
Jim--

Thank you!  That is exactly what I needed.

kc64
0 Kudos
Message 4 of 4
(3,107 Views)