LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I change the items of an Enum at Runtime?

Solved!
Go to solution
Solution
Accepted by topic author alecjcook

Your approach is not practical. You cannot have code modify itself, so you're simply going to have to deal with that limitation. Welcome to the universe.

 

I would suggest looking at saving this information in an external file. That way you can read in this list of labels and use a ring.

Message 11 of 16
(1,662 Views)

"array of strings, and I would like edit a ready existing Enum so that the currently existing values become that in the array."

 

If you want to change the programming variable, you can replace the enum with a string control, change that and then replace it with an enum and you'll have the updated control. It will only work while developing though.

/Y 

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 12 of 16
(1,660 Views)

your code could be greatly simplified by using cluster to array and array to cluster.  (Which begs the question "Why a cluster at all when an array would be more practical?) Smiley Wink


"Should be" isn't "Is" -Jay
0 Kudos
Message 13 of 16
(1,648 Views)

I still think what I have done it fitter than array to cluser, because array to cluster does not create self documenting code...

From my original code, I have turned the enum to type def, and I have my solution

0 Kudos
Message 14 of 16
(1,632 Views)

Hi 

 

I had simmilar issue,when I need to enter 100 values into Enum. 

So what you need to do is

1. Reaplce your Enum with Ring

2. Use the "Strings[]" for the ring to populate your control

3. Replace back to Enum

4. Create a type def out of this new Enum

 

It works at least for me 🙂

Message 15 of 16
(1,513 Views)

Hi 

 

I had simmilar issue,when I need to enter 100 values into Enum. 

So what you need to do is

1. Reaplce your Enum with Ring

2. Use the "Strings[]" for the ring to populate your control

3. Replace back to Enum

4. Create a type def out of this new Enum

 

It works at least for me 🙂

0 Kudos
Message 16 of 16
(1,513 Views)