08-29-2008 10:34 AM - edited 08-29-2008 10:37 AM
Maybe this is not a correct use for type definitions, and to be honest I just started using them in my vi's. But I was wondering, can I use a type defined combo box to auto update the combo box control from one vi to the next? To demonstrate I attached some sample files. The first vi is named enum1.vi
It's input is a combo box control containing two items "Test 1" and Test 2" and an output that is an integer showing which test is chosen. I have saved this combo box as a strict type definition in cntrl 1.ctl
The 2nd vi is enum2.vi and has nothing but enum1.vi and has it's input and output wired accordingly to a control and indicator. How do I make enum2.vi update it's combo box control automatically when I change enum1.vi?
Regards,
-SS
Edited files from 8.6 to 8.0 so more people can view.
08-29-2008 11:17 AM
That is the reason why Type Defs. are so powerful.
You want to go into your Enum2.vi whose control is currently just an ordinary one. Select the control, right click, and select replace. Pick the Control1.ctl. Save the file. Now whenever you open up the Type Def control and edit it, all instance where the control is used, (which will now be Enum1.vi and enum2.vi) will be updated.
08-29-2008 01:03 PM
09-04-2008 09:30 AM
RF,
Is there a bug still regarding the use of enums as constants in LabVIEW 8.6? I seem to remember reading this and came across this problem when updating my code. In other words you are required to change every constant to a control and back to a constant for the enum parameters to update accordingly.
Regards,
-SS
09-04-2008 09:34 AM
SS,
To the best of my knowledge there isn't a bug in the enums. What issue are you refering too?
Ben
09-04-2008 09:47 AM
09-04-2008 09:52 AM
No, the cosntat enum should retain its value UNLESS you delete the choice from the enum. In that case it should break and remind you that the constant has to be set to a valid choice.
Ben
09-04-2008 09:52 AM - edited 09-04-2008 09:53 AM
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.
09-04-2008 09:56 AM
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
09-04-2008 10:01 AM
I t remember a special condition that I mentioned in my Type def Nugget
If the enum is in a cluster and the cluster is edited to either add or remove fields, then default value of the enum will be used in the cluster constant on the diagram. This is why I encourge developers not to rely on the value in a cluster constant but rather explicitly "Bundle by Name" the proper enum value.
Like I said, I illustrated this in my Nugget.
Ben