09-04-2008 10:19 AM
Ben wrote:
JeffOverton wrote:I don't know about 8.6, but in 8 through 8.5 the constant will update when you change the typedef.
edit - Specifically if you add options to the enum, the constant will update to allow those new options to be selectable.
Message Edited by JeffOverton on 09-04-2008 10:53 AM... but after the update the value it was set too will be retained as long as that value is still present. When I say "value" I'm refering to the string that was selected. Even if the enum is re-ordered such that the numeric value associated with the string is different, it should still have the same stirng selected.
Agreed?
Ben
Oh, I agree with that, yes. The specific value of that specific constant instance of the type def will remain the same unless it's deleted from the type def. I was speaking more in terms of enumerating states for a state machine, and if you add a state to the typedef, you can just right click the case structure and "add case for all values" because the constant will autoupdate as well.
09-04-2008 12:20 PM
09-04-2008 12:50 PM
I see what you mean. But there is one complication in your example. You do not have an Enum. You have a ring control.
I'm not sure if the behavior being shown is expected or not, but I know that there are some differences between enums and ring controls. In enums, the name of a value is an integral part of the control. In rings, the value is the key item, the name used in the display is more of a "decoration" and is not a critical part of the definition.
That is why if a control's names needed to be changed during runtime, it is required to use a ring rather than an enum.
09-04-2008 01:04 PM
Ravens Fan wrote:In rings, the value is the key item, the name used in the display is more of a "decoration" and is not a critical part of the definition.
That is why if a control's names needed to be changed during runtime, it is required to use a ring rather than an enum.
I believe that is expected behavior, because of the following: Wire a ring to a case structure and wire an enum to a case structure, and the selectors will be completely different. Additionally, the terminal of a ring control even says U16, while an enum is just the left and right arrows.
09-04-2008 01:24 PM
09-04-2008 01:37 PM
09-04-2008 01:47 PM
Try this.
Go to your Ring constant. Right click change to control. Right click change to constant.
I don't know why, but that seemed to update the control to the saved type def. which persisted when it changed back to a constant.
It isn't automatic and in the background, but it did do the update in a few mouse clicks.
09-04-2008 02:15 PM
I replaced the ring constant with an enum constant. The values from the ring did not automatically transfer over, so I had to edit the enum constant to add all the items. I then made it a strict type def and saved it.
After that, I opened the control.vi and edited and deleted items, then saved it. I didn't see any problems with the enum constant being updated automatically when I edited the strict type def control.
09-04-2008 03:25 PM - edited 09-04-2008 03:28 PM
JeffOverton, Yes "Auto-Update from Type Def." is checked and typedef is strict.
Ravens Fan, Yes your work around will work with ring controls but I was trying to avoid this.
The problem went away since I was accidentally not applying changes from the ctl file, this is important![]()
Thanks guys for your help, I'm still learning the in's and out's of this useful feature. -SS
09-05-2008 06:27 AM
ShotSimon wrote:The problem went away since I was accidentally not applying changes from the ctl file, this is important
haha, that'll do it![]()
also, if you save the changes (but don't apply them) and then close the .ctl it will automatically apply the changes