Randy81 Posted September 6, 2007 Report Share Posted September 6, 2007 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? Quote Link to comment
JDave Posted September 6, 2007 Report Share Posted September 6, 2007 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. Quote Link to comment
Grampa_of_Oliva_n_Eden Posted September 6, 2007 Report Share Posted September 6, 2007 Timing of this Q dicates I should mention that I wrote a Nugget on this last week. http://forums.ni.com/ni/board/message?boar..._date_ascending The included example may be of some use. Ben Quote Link to comment
Justin Goeres Posted September 7, 2007 Report Share Posted September 7, 2007 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? This sounds (unless I'm misunderstanding) like an ideal use case for the OpenG Variant Configuration File tools: http://forums.lavag.org/index.php?act=attach&type=post&id=6856 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. EDIT: Jim did a blog post about them here. Quote Link to comment
JDave Posted September 7, 2007 Report Share Posted September 7, 2007 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. Quote Link to comment
silmaril Posted September 7, 2007 Report Share Posted September 7, 2007 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 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.