01-26-2010 10:53 AM
01-26-2010 11:26 AM
If you'll think about it, you'll see why this doesn't make sense - the case structure needs to have the cases assigned at *edit time*. For example, let's say you set the ring/enum at run-time to have the values "apple, orange, banana" - how do you now define which frame in the case structure handles "banana"?
01-26-2010 11:28 AM
the data type of teh XControl would still have to be an enum...
It is possible to start with a ring, write its values programajically and then right-click and do a replace with an enum. All of your strings will come across. Yes theis will NOT work if you have gaps in your number seq.
Ben
01-26-2010 11:55 AM - edited 01-26-2010 11:57 AM
You might consider just using string constants as your case selector instead of a ring or enum. There are some definite draw-backs, such as possible typo errors, but you can help account for this by creating a Default case that should never execute that simply pops up a dialog warning the developer about the typo.
I use strings all the time when using Queued State Machines to define the cases. To me it's easier than dealing with an enum, especially because enum array constants on a block diagram always resize to a small size when you add new enum items! This makes code quite unreadable. Also, when you add a new element in a enum array constant, it defaults to the first enum value, which is visually confusing for me. Seeing an empty string pop up in the array constant is much easier on the eyes.
Strings will offer you the maximum flexibility, but the previous posters are still correct in asserting that the cases of the Case Structure need to be defined at edit time. You can't dynamically change these while the program runs.
Is your main problem with enums that using the Edit Items dialog for an enum is very slow and not user-friendly (which I agree with)?