09-20-2012 09:09 AM
I have a situation where I create a cluster based on the contents of an ini configuration file. As the contents of the ini file may change, adding or subtracting sections, changing section names or values of keys, etc. the read routine has to be dynamic.
The key name(s) will remain constant but because the number of sections and names are not constant, a fixed typdef is not an option for the cluster control I want to populate. I can read in the section names easy enough but am unable to figure out a way to use that information to create a cluster and identifying the controls with those section names.
Any thoughts on this are much appreciated.
Doug
09-20-2012 09:14 AM
You cannot dynamically change a cluster at run-time. Yes, you can do it with scripting, but this only works in edit mode. I.e., you can use scripting to create a new VI and place a cluster on it and add items to the cluster, and then save that VI. However, this will not work at run-time since a program cannot change itself. At least not yet.
You will need to use an array of some sort. Not clear what that should be, since you haven't indicated what this configuration file looks like, and what's likely to change, and what you're doing with this information.
09-20-2012 09:26 AM
I was expecting that and am already mulling around alternate approaches.
Thanks.... Doug
09-20-2012 09:31 AM
There is sort of a way to have self modifying code. After a VI is altered with scripting, it can be loaded into a subpanel, and it can be called dynamically.
09-20-2012 11:29 AM
I am unclear on what you need to do with these values after you have them. A multicolumn listbox may be your best bet, in any case. You can fully populate it with strings and set/get values from it based on clicks. You can use a picture control in much the same way.
You can create a custom panel and load this in a subpanel at run-time. You can interact with the new controls using dynamic user events or an event structure on the custom code which feeds a queue to the calling code. This will require the full LabVIEW development system - run-time engine is not enough. It is also very advanced LabVIEW programming. The multicolumn listbox and/or picture control would be easier.
09-20-2012 11:52 AM
The information I am pulling in this particular instance is file / folder paths for certain data files, configuration files, label files, report locations etc. My original intent was to be able to pull in the various paths from the ini file and based on the section name, be able to utilize wherever needed.
After some thought, I expect I will need to add a little more structure and discipline to the ini file and just bring the various paths into a pre-configured [typdef] cluster. If I utilize a simple sub-vi for this, it would mean minimal editing in the future for multiple systems.
I am using due's but am trying to not have any user input required for this function.
Thank.... Doug