问题:我有一个输入框,让用户只能从规定列表中选取值输入,那么我就要用enum,但是enum输出的值是它的value,value永远都是从0开始的递增数,我才不想要这个数值,我想要用户在列表中选取的的那个数值。
精简:即获取enum中的item值,而不是value。
思路:获取到item列表(string类型),用value去index这个列表,再转换为数值
Method 1: Property Node with an Enum Control
If an enum control or indicator exists, create a property node for the enum and select the Strings[] property. This property returns an array of strings for the specified enum. Then use the Index Array function with the enum wired to the index terminal to access the desired string.
Method 2: Format Into String
If there is no enum control or indicator in the VI, wire the enum to the Format Into String function input; with a string value of %s wired to the format string input. This function returns the string value associated with the input enum value.
两种方法都画在下面