04-07-2009 01:33 PM - edited 04-07-2009 01:33 PM
Hi everyone,
I am curious that whether an ENUM type could be an index input for a For Loop (actually i tried in labview but it was NOT working).
I use Enum for my two configurations(only two elements there), but some times I need to run both of them together.
I am wondering if there is some good structure to handle that or I just replace ENUM with array.
Thanks,
-Kunsheng
Solved! Go to Solution.
04-07-2009 01:42 PM - edited 04-07-2009 01:42 PM
Kunsheng,
The "value" of a ENUM is a unsigned 16bit integer that represents the current index of that control (as viewed by right clicking the ENUM and selecting "Edit Items..." )
There are several ways to use this value to then control the FOR loop. One simple solution would be to wire the ENUM to a Case structure - the cases can then define what you want your For loop to do.
You can also use property nodes, array indexing, etc. to accomplish similar results.
Have Fun!
04-07-2009 01:52 PM - edited 04-07-2009 01:53 PM
04-07-2009 06:57 PM - edited 04-07-2009 07:02 PM
04-07-2009 08:31 PM
04-08-2009 04:22 PM
Check out this post for a way to do it without using property nodes. Property nodes cause LabVIEW to swap to the User Interface thread and generally slow you down, so avoid them when you can. This method also allows you to use an enum constant instead of a control.
04-08-2009 04:33 PM
04-08-2009 07:32 PM
Awesome! I played a little bit with property node today. Got a feeling of windows forms programming in .NET, u play around all attributes of certain control there.
05-25-2010 11:11 AM - edited 05-25-2010 11:13 AM
Jarrod S. wrote:Check out this post for a way to do it without using property nodes. Property nodes cause LabVIEW to swap to the User Interface thread and generally slow you down, so avoid them when you can. This method also allows you to use an enum constant instead of a control.
![]()
Lava seems to have changed the indexing of their messages. By any chance, could you relink your message to the post you referred to?
thanks,
Ron
05-25-2010 02:22 PM
Here is a code snippet of itterating over each intem in an enum list, no property nodes needed.
It uses the flatten to string (the enum length is at index 2 of the header)
Change the enum and the code will automatically execute add it to the list of things to do, like a for each structure