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

I have an enum that is full of items. I would like to change the lables on these items at runtime. When i attempt to, using the property node "Strings []" I get the following Error:

"Error 1073 occurred at Property Node (arg 1)

Possible reason(s):

LabVIEW:  This property is writable only when the VI is in edit mode, or this method is available only when the VI is in edit mode.

Property Name: Strings [] "

0 Kudos
Message 1 of 16
(6,821 Views)

You cannot change item names of an enum at runtime. That is why you get the error.

PaulG.

LabVIEW versions 5.0 - 2020

“All programmers are optimists”
― Frederick P. Brooks Jr.
0 Kudos
Message 2 of 16
(6,820 Views)

what is it you are doing that requires you to change an enum at runtime?  perhaps other methods may be more suitable

 

 

Please remember to accept any solutions and give kudos, Thanks


LV 8.6.1, LV2010,LV2011SP1, FPGA, Win7
0 Kudos
Message 3 of 16
(6,815 Views)

is there any way to do this programatically. I have an array of strings, and I would like edit a ready existing Enum so that the currently existing values become that in the array.

0 Kudos
Message 4 of 16
(6,814 Views)

as paul said, this cant be done and I would have thought this would go against the principle of an enum. Can you not use the array directly? Can you describe the application please? may make it easier to suggest alternatives

Please remember to accept any solutions and give kudos, Thanks


LV 8.6.1, LV2010,LV2011SP1, FPGA, Win7
0 Kudos
Message 5 of 16
(6,809 Views)

Hi,

    So I am trying to create a VI in which I can store my result. I have taken over a lot of code that is a bit in a mess and I thought that this might be the nicest way to go about things. This VI has space for 50 bits of results data (strings). Within a parent VI I intend to place this vi, Create a constant for the Label and corretly label and store the results info created in the parent VI. At the end of the app all this data will be returned using the label data... I would be very nice if I could do this by just entering data into an array as appose to editing the enum. If the best way is to use this VI as a template and edit the enum, then let me know. Cheers, Alec

0 Kudos
Message 6 of 16
(6,808 Views)
There are a few possibilities. replace the enum with a ring is the simplest but, it sounds like you have larger issues. I'll have to look at your code later.

"Should be" isn't "Is" -Jay
0 Kudos
Message 7 of 16
(6,800 Views)

You cant change values of enum at runtime. You would need to replace the enum with combo box, ring or similar control.

-FraggerFox!
Certified LabVIEW Architect, Certified TestStand Developer
"What you think today is what you live tomorrow"
Message 8 of 16
(6,796 Views)

I can't look at your code right now, but from your description you may want to use a Combo Box or Ring instead of an Enum.

 

http://lavag.org/topic/5147-enum-vs-ring/

 

 

(I'm so slow in typing my answer compared to others, but maybe the hyperlinks will make up for it Smiley Tongue)


Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
If you don't hate time zones, you're not a real programmer.

"You are what you don't automate"
Inplaceness is synonymous with insidiousness

0 Kudos
Message 9 of 16
(6,794 Views)

If it use a Ring, The right clicking on the input terminal associated with the control and selecting "Create Constant" will not give me a list of all of the possible labels. This feature is integral to the working of the vi as explained above

0 Kudos
Message 10 of 16
(6,783 Views)