LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Preview ini file content in dialog - best practice? (OpenG variant config files)

I am designing a module which will deal with configuration files. I use the OpenG Variant config file toolkit to create ini files.

I wonder what would be the best practice in the following situation

  1. I have a typdef cluster with some subclusters holding config info
  2. I would like to have a "preview" function, so showing a modal popup dialog to the user, what will be the content of the .ini file (the user will be familiar with the config.ini file structure, and naming)
  3. At this preview window, the user can decide to save the config into to file or not.

The other direction is the same: when a user loads an existing ini file, they should see a preview dialog before deciding whether to apply the new configuration settings or not to the app.

 

As a workaround, for the first case, I imagine I could create a temporary ini file, then open it as a simple text file, and load its content as simple text. The other case, I open again the existing ini file as a normal text file, and read its content as text.

I do not really like to create temporary files, then deleting them programmatically, do you have some better idea? Would be nice to have two special OpenG VIs like "Preview INI file content as text", and "Simulate INI file content and show it as text"...

 

EDIT: and even if I do it using my idea, I have still the problem that the content of the ini file will not be presented in a nice way. It would be cool to have some toolkit in LV, which could parse and colour/structure an ini file content to show, just like for example Notepad++ does:

 

parsing_notepad++.png

0 Kudos
Message 1 of 5
(3,473 Views)

OK, actually using a simple EOL delimited string into a string indicator is acceptable, not pretty, but easy to read, see snippet below.

But my question is still, is there a good trick to avoid creating temporary file creation/deletion before we decide we actually want to create the ini file or not?

 

string1111.png

0 Kudos
Message 2 of 5
(3,459 Views)

So I just proceed this way, to preview how the content of the ini file would look:

 

preview_cluster_as_ini.png

0 Kudos
Message 3 of 5
(3,443 Views)

try this attachment:

 

Then your prompt will read  "Observe the ini file in Notepad++ and ...."

 

A nice gift from Hoovahh.  Windows only


"Should be" isn't "Is" -Jay
0 Kudos
Message 4 of 5
(3,421 Views)

Thanks Jeff, I might use this as an "extra option".

Actually I started to think, a Tree indicator could be a nice way to show INI file sections and elements/values to the user. Via VIPM I installed the NI Tree toolkit, and there is one example for XML files. I imagine, this could be adapted to INI files:

"Tree Data Types and XML Example.vi"

 

Tree API.lvlib_Tree.lvclass_Tree Data Types and XML Example.png

0 Kudos
Message 5 of 5
(3,386 Views)