10-13-2005 01:31 PM
10-14-2005 05:04 PM
Hi Jason,
That is a great question. I don’t believe the functionality of the text ring has changed much from previous versions, however you should be able strictly type a ring control in both LabVIEW 7 and 8. When a control is strictly typed it will force all instances to be identical to the strict type definition and update all of the text constants. The regular type def only checks to see if the data type of the control has changed. I hope this helps.
Cheers,
Chris J
10-15-2005 10:40 AM - edited 10-15-2005 10:40 AM
Part 1 of 2
Message Edited by Ben on 10-15-2005 10:41 AM
10-15-2005 10:41 AM - edited 10-15-2005 10:41 AM
part 2 of 2
A ring is nothing more than a numeric with a fancy GUI implementation that allows you to choose the value based on a list. Once the numeric value is selected the strings do not come into play.
In order to change a rings functionality such that it behaves like an enum would require the data type of the ring be redefined. This would make all data log files or any other data structure that is produced by doing a "flatten to string" incompatable with earlier versions of LV. LV 7.1 can open datalog files going back to LV 5.0 because this data structure has been stable. Similarly, VI server in LV 7.1 is able to call VI's served by LV 6.1.
There would have to be a VERY good reason to abandon all of those older versions of data log files and other functions for LV 7.1 and and earlier.
Although this request may seem trivial, if implemented, all of the VI that have been devloped over the last 7 years would become obsolete and incompatable with the new version of LV. If this type of change is implemented, NI better put on their flame suits because there will be a lot of un-happy developers.
The enum and ring although similar in appearance are very different data types. Each have their place in LV and perform their functions well.
Trying to help,
Ben
Message Edited by Ben on 10-15-2005 10:42 AM
10-15-2005 01:38 PM
I should have written
"
10-17-2005 08:34 AM
Hi everyone,
Thanks for all of the replies - I appreciate it! It apears as if we will have the same problem with rings that we did in earlier versions of LabView - it probably will not update. What I am trying to do is the equivalent of a typedef enum in C with specified values, such as:
typedef enum
{
Cmd_1 = 0x1000,
Cmd_2 = 0x1100,
Cmd_3 = 0x1200
} Commands;
The problem here is that if you creat a *constant* somewhere, then go back and change the value of Cmd_2 from 0x1100 to 0x1150, for example, the constant in your code will *not* reflect that change.
Thanks again!
Jason
10-17-2005 08:55 AM
Hi Jason,
What you are looking for is "sparse enums".
We have been asking for that feature for years.
Years ago Rolf Kalbermatter posted to Info-LabVIEW explaining how to create them in in CVI and then import them to LV.
I also would like to "sparse enums".
Ben
10-17-2005 10:46 AM
This is the Info-LabVIEW posting by Rolf Kalbermatter wrote.
"
>You will find the following values of this enum-const:
>first item: value = 0
>second item: value = 1
>third item: value = 20
>
>This is a very interesting phenomen. But how can I produce such a
>enum-const with individual value by myself?
You really can't (yet)! Although LabVIEW can deal with such sparse enums
there is no editor interface to create them. The ComponentWorks library
has an according definition in the ODL file and LabVIEW generates such
an enum when importing that ODL definition. Another way to create them
is by creating a FunctionPanel in LabWindows CVI and import that Function
Panel with the Tools->Instrumentation->Import CVI Instrument Driver.
Rolf Kalbermatter
"
Ben
10-17-2005 10:53 AM
This is pretty much the feedback I have been getting. IMHO, it really comes down to a design deficiency in the LabView enums. LabView provides a graphical way of programming, but to be considered a "real" programming language by some of the hardcore C and C++ guys, it is going to have to mimic some of that functionality. A "C" enumeration will assign sequential numbers, starting at '0' if you just have:
typedef enum
{
item1,
item2,
item3
} items;
However, you can include "=" signs afterwards to manually control this. That functionality really ought to show up in LabView one of these days.
10-17-2005 11:02 AM
"That functionality really ought to show up in LabView one of these days."
Ditto that!
A converter will let you code this up.
Wire up an enum to a case and get rid of the "default" case.
Make sure there is one case for each enum value.
In each case drop the proper constatnt and wire it out through an output tunnel of the case structure.
Drop this VI beween the enum and "something else" any time you want to convert from enum to the "sparse" version.
If the enum is made a type def AND there is no default case, when new enum values are added, the "converter" will break reminding you that the "converter" needs updated to keep up with the enum.
Yes, LV should have "sparse enums"!
Ben