05-30-2012 09:46 AM
Hi! I also have a question about state machines: once your state machine is built and fonctionnal, how do you edit the item list of the Enum Constant Properties (like remove or rename a state) and have the Case structure reflect the changes? When I do the slightest change to the list, all the related information in the Case structure disappear leaving only case numbers? Can anyone help me? Thank you very much!
05-30-2012 10:00 AM
Use a typedefed ENUM. Use this typedef for ALL of your ENUM constants in your state machine. That way when you edit the typedef everything derived from it will be updated as well.
05-30-2012 10:21 AM
Hello Mark,
Thanks for the quick response! I tryed to modify my Enum Constant to select the "Update from Type Def." option, and then modify a list item name. Unfortunately, the Case Structure does the same thing: all information related to the Enum item list disappear except for the item numbers. Am I doing something wrong, or haven't I understand correctly your instructions? Thanks for your help!
05-30-2012 10:25 AM
@StephChouinard wrote:
Hello Mark,
Thanks for the quick response! I tryed to modify my Enum Constant to select the "Update from Type Def." option, and then modify a list item name. Unfortunately, the Case Structure does the same thing: all information related to the Enum item list disappear except for the item numbers. Am I doing something wrong, or haven't I understand correctly your instructions? Thanks for your help!
Yes, ALL instances of the ENUM, and I mean EVERYONE of them, but use the typedef. If even a single one does not the case structure will only show numbers if you changce the ENUM typedef.
05-30-2012 10:33 AM
I did change ALL Enum Constant occurences in the Case structure to select the "Auto-Update From Type Def." option, and still, the Case Structure lost all information but the item numbers...
05-30-2012 10:39 AM
Were they all created from the same typedef? Can you post you code? It is easier to see what is going on if one can actually see the code.
05-30-2012 12:13 PM
Here is my code before modifications...
05-30-2012 01:03 PM
You did not include your typdef. In addition, only one of your ENUMs in this code was associated with the typedef. Modifying the typedef would result in the behavior you described. It would be much more helpful for you to post the code after your modifications that you say is not working.
05-30-2012 01:14 PM
Hello again Mark,
When I try to "Update from Type Def." all my ENUMs, the system saves a new Control Type Def every time instead of pointing to an existing one. I end up with as many Control Type Def files (Control x.ctl) as I have ENUMs in my code. I must be doing something wrong, but I don't know what?
05-30-2012 01:17 PM
Replace all of your ENUMs with th etypedef. Don't create a new one for each one. For each of your ENUMs right click on it and choose replace. Then select your typedef. Lesson to be learned here is that you should always use typedefs for ENUMs. If you start there you don't waste a ton of time replacing all of your instances or modifying all of them to make a change.