08-08-2024 08:16 AM
@crossrulz wrote:
@MrJackHamilton wrote:
If you wired up the error cluster...you'd see LabVIEW does not allow this. What is odd is that LabVIEW should.
No, it should not. You are trying to update an enum while it is in a run state. That definitely should not be allowed. From another VI, you can get a reference to this VI and update the enum. That is because then the VI with the enum will be in an edit state.
It's not just "it should not", but it must not. The enum strings are part of the data type, and data types cannot change at runtime. If you wire an enum to a case selector, and have a case for each possible enum string, that code would break if the enum strings changed. Asking to be able to change enum strings at runtime is asking to be able to have code render itself uncompilable.
08-08-2024 10:14 AM
Hi @francsicohdz,
@francsicohdz wrote:
Hello ,
Here an example of programmatically fill the elements of enum
programmatically. for enum controls the data cannot be fille during exection , the this vi is open the cotrol from another VI and adding the data 🙂
Type-casting a refnum like that can be dangerous (if not done correctly), it is safer to use "To More Specific" instead.
Also, the Panel refnum does not need to be closed, it is a no-op. See this post from Darren.
Finally, if you use VI scripting for e.g. creating automatically an enum type definition, you will need to call VI method "Save.Instrument" at the end to apply changes and make them persistent.
Regards,
Raphaël.
08-08-2024 12:16 PM
I think you would also want to apply changes and save the .ctl.