06-05-2025 09:15 AM
So far we are able to change ring value dynamically with LabVIEW but not for enum with .ctl files. Is there any effective method to dynamically edit the contain of the enum using LabVIEW?
Solved! Go to Solution.
06-05-2025 09:24 AM
Hi skykong,
@skykong wrote:
So far we are able to change ring value dynamically with LabVIEW
Yes.
@skykong wrote:
Is there any effective method to dynamically edit the contain of the enum using LabVIEW?
Nope.
Enums are defined at edit time (as they define the datatype).
Changing them requires to recompile your executable - which isn't possible at runtime…
06-05-2025 09:36 AM
You can, but the Enum must not be reserved for execution.
This example works as long as no running vi uses the ctl:
Of course, the file MyEnum.ctl must exist already.
06-05-2025 09:50 AM
Great! Can you provide the vi for references? Thanks.
06-05-2025 09:59 AM
@skykong ha scritto:
Great! Can you provide the vi for references? Thanks.
It's a snippet. Save it as a picture (.png) and then drag it into a Block Diagram.
Of course, you need LV>=2021
06-05-2025 10:16 AM
@pincpanter wrote:
You can, but the Enum must not be reserved for execution.
This example works as long as no running vi uses the ctl:
Of course, the file MyEnum.ctl must exist already.
Maybe we should take a step back and ask why updating a ring is not sufficient?
06-22-2025 12:18 AM
This method won’t work because this only workable if execution is stop. Is there any method that work with executable is continue running?
06-22-2025 07:46 AM
@skykong wrote:
This method won’t work because this only workable if execution is stop.
This is what others were meaning when they said:
@GerdW: "Enums are defined at edit time (as they define the datatype).
Changing them requires to recompile your executable - which isn't possible at runtime…"
and
@pincpanter: "the Enum must not be reserved for execution.
This example works as long as no running vi uses the ctl"
@skykong wrote:
Is there any method that work with executable is continue running?
Enums by definition are not editable at runtime. If you want a drop-down list with items settable at runtime, you have to use either a Ring (numeric data type) or a Combo Box (string data type).
Regards,
Raphaël.
07-07-2025 08:07 AM
Actually, I encountered this issue about 10 years ago during my early experience with LabVIEW coding. While there are always workarounds, I'm still curious to see if a proper resolution exists now. but it still seems like a dead end. The reason I prefer using an Enum over a Ring or Combo Box is that a Ring only passes numeric values to the case structure, and a Combo Box requires manually renaming the case labels before use. In contrast, an Enum automatically updates the case structure names based on its items. You can even update the cases and extract state names when needed. Just sharing. Cheers!
 
07-07-2025 08:24 AM
All of your advantages only affect edit-time behavior. Why do you need it to work during run-time? If you have some run-time activity that suggests changes to the enum for later edit-time activity, try recording all needed changes until shutdown, then unload the control and use pincpanter's approach before finally closing everything.