12-18-2023 01:24 PM
I have a settings module for a program (using DQMH, but not sure if that's truly relevant) which has a tab control on the front panel and across the tabs, there are 21 individual front panel controls, some of which are themselves clusters of multiple controls. When I load the config file, the "load config file" state in the QMH will load all values in a subvi, write them all to the QMH state data, and set the values on the front panel. This results in a huge messy block diagram in the QMH state. I would like to put the setting the front panel values into a subvi, but I couldn't find a good way to access all controls. This is what I've got, it uses three loops and in the end gives an array that can be used to search for the individual controls by name, which I'm going to have to do 21 times.
Please let me know if there's a better way to do this.
It works, but this has to be something with an elegant solution. In implementation, the static vi ref is replaced with a vi reference passed in.
Thanks
12-18-2023 02:23 PM
menu -> Functions -> Programming -> Application Control -> VI Scripting -> Traverse for GObjects.vi
12-18-2023 02:50 PM
What version of LabView has this? I'm on 2021 and there's no VI scripting palette in application control.
12-18-2023 02:55 PM
If I understand you correctly, you are making a settings module for an app that can read/write to INI file, etc. If so, you might want to check out this forum post. Maybe there are some ideas you can piggyback off of to get yours working.
https://forums.ni.com/t5/Reference-Design-Content/LabVIEW-Options-Dialog-Framework-ODF/ta-p/3526554
12-18-2023 02:58 PM
Hey, this looks neat. I'll bookmark it. But the settings module I've made already works, I'm specifically asking about assigning values to a large number of front panel controls from a subvi so I can clean up my block diagrams.
12-18-2023 02:59 PM
did you enable scripting in labview ide?
12-18-2023 03:02 PM
@Nokaroa wrote:
What version of LabView has this? I'm on 2021 and there's no VI scripting palette in application control.
Enable scripting from the LabVIEW options:
12-18-2023 03:46 PM
If you don't want to enable scripting (for instance, to keep the listed properties on a property/invoke node smaller) you can just find the VI itself:
\LabVIEW 20xx\vi.lib\Utility\traverseref.llb\Traverse for GObjects.vi
In theory this VI should work OK in a compiled EXE if you only search the front panel. If you try to traverse a block diagram it will likely fail.
Also, don't forget that there is no guarantee of the uniqueness of the Label.Text field on a VI. You might want to pair your data saving with the UID of the control and use the text field as a label of convenience rather than assignment.
12-19-2023 11:06 AM
@Nokaroa wrote:
Hey, this looks neat. I'll bookmark it. But the settings module I've made already works, I'm specifically asking about assigning values to a large number of front panel controls from a subvi so I can clean up my block diagrams.
My response wasn't suggesting that you replace your settings app with the one from the link. There may be some methods of transferring references in that library that may be useful to solve your problem.