Minneapolis LabVIEW User Group

cancel
Showing results for 
Search instead for 
Did you mean: 

Smarter Configuration Dialogs: User Group Presentation July 21 2015 - Tore Johnsen

Are you tired of recreating the configuration dialog for every application?  This user group presentation shows how to automate that process

Highlights from the presentation


I gave the settings dialog the same look-and feel as LabVIEW's own Options (Tools>Options) dialog.

The configuration settings dialog.jpg

Figure 1: The Edit Settings Dialog

Modules supply their own settings VIs.jpg

Figure 2: Simplified Application architecture. Each code module supplies its own simple settings user interface VI.


If your application use plug-in modules loaded dynamically at run time, they can supply their own configuration settings (settings.vi) to the  dialog. We implement our code modules as LabVIEW classes. Each class includes a very simple "settings.vi". See the figure below. As you can see, the settings.vi is extremely simple.

The settings VIs are very simple.jpg

Figure 3: The settings.vi

When embed the VI in the dialog's sub-panel, we run the VI once with init set TRUE to populate the controls.

When the user is done updating the settings we run the VI again with init set false – it now writes the updated values to the object and passes the object out.

This simple approach works fine as long as there are no need for a programmatic interaction between controls in the settings.vi – it does not work well if a selection in one control is used to update the content in another. But, this simple approach covers the vast majority of our applications, we therefore chose to keep it this simple – we can always add more complexity if needed.

All we need to do is to pass in an array of objects. The Settings Handler VIs locates the settings VIs for all classes, the class names (e.g.: "Data Logging", "Data Acquisition") becomes the name of the categories listed. When you click a category the corresponding settings.vi from the class is embedded in the sub-panel.

The settings VIs are embedded in the Dialog sub-panel.jpg

Figure 4. Inserting settings VIs into the dialog.

Let's look at the diagram for the demo code:

Reusable subVIs are included in the download.jpgFigure 5. Screenshot of demo code.

To insert settings.vis from your classes, simply pass in an array of objects. The supplied Settings Handler VIs (yellow banner) handles the rest. Each class must include their own "settings.vi". The Settings Handler VIs assume that your code modules are designed as LabVIEW classes, that each class includes its own "settings.vi", and that your application only need to edit settings for one instance of each code module. Configuration files are XML - one file per object. It will be fairly easy to modify the design to handle more than one instance of an object.

I hope you find this useful. Suggestions to improvements are welcome.

- Tore Johnsen, Saint Bernard Engineering, Inc.

Downloads

There are more details in the presentation (check out the presentation notes too). The download contains presentation and code. LabVIEW version: 2014.

Message 1 of 2
(5,672 Views)

In case anyone else is interested in downgrading this to LV2012, I created a VI to replace the Get LV Class Name.vi (which was new in LV2013)

https://decibel.ni.com/content/docs/DOC-43616

0 Kudos
Message 2 of 2
(4,280 Views)