Jump to content

Loading configuration info into controls


Randy81

Recommended Posts

I'm currently trying to write a configuration dialog for a program of mine. I have a config.ini file and I would like to read the file and load the configuration information into the controls on my front panel. I was thinking of having some kind of table which identifies a configuration key and its corresponding control label. In which case, I would search my front panel display and set the control value using a property node. This seems very inflexible, but it's the best idea I have so far. Any suggestions?

Link to comment

QUOTE(Randy81 @ Sep 5 2007, 01:21 PM)

I'm currently trying to write a configuration dialog for a program of mine. I have a config.ini file and I would like to read the file and load the configuration information into the controls on my front panel. I was thinking of having some kind of table which identifies a configuration key and its corresponding control label. In which case, I would search my front panel display and set the control value using a property node. This seems very inflexible, but it's the best idea I have so far. Any suggestions?

One easy thing to do is to have a conversion VI that converts configuration keys to control labels / references. That gives you a layer of abstraction between the config file and your control labels. Any change to the labels just requires a change to the conversion VI, and doesn't affect your configuration files.

Link to comment

QUOTE(Justin Goeres @ Sep 5 2007, 04:26 PM)

This sounds (unless I'm misunderstanding) like an ideal use case for the http://openg.org' target="_blank">OpenG Variant Configuration File tools:

The image shows the context help for the VI that reads(/writes) an arbitrary cluster to a file, but the VIs below that in the palette (also indicated by arrows) allow you to read(/write) values from a config file directly to/from front panel controls.

These are really cool VIs (at the top of Jim's list, even), and the ones you refer to take the VI's whole front panel at one shot (one VI !!)

I am not sure what was meant by flexibility. I interpreted that to mean that the control labels may change, which would break the configuration file. Using the OpenG solution would give you this same dependency and problem. Maybe ease of use was most of the flexibility issue, and if that is the case then the OpenG toolkit is the way to go.

Link to comment

QUOTE(dsaunders @ Sep 6 2007, 02:15 AM)

I am not sure what was meant by flexibility. I interpreted that to mean that the control labels may change, which would break the configuration file.

There is an easy way to solve this particular issue: When designing your panel, use labels that tell the programmer what the control does. Then hide all your labels and display captions instead. You may change the captions as often as you like without touching the labels.

If you take a look at any localized version of LabVIEW, you have loads of example VIs that show what I mean in your function palette :shifty:

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.