I've been working on this app following your intentions and the results are fairly optimized with a very good performance on a full txtsetup.sif running on a moderate PIII with 512 of RAM.
These results were optimized by interpreting the txtsetup.sif file only once, using these steps:
1 - Add each new section at the treeview
2 - copy the portion of text up to the the next section to the newly created node
--2a if the section is duplicate - add the new lines on the previously created node
3 - loop to step 1 until end of file
----------
All nodes are alphabetically sorted and *most* empty lines removed away (except for some pontual cases to help reading)
I've chosen to use raw text instead of INI interpreting because there are many sections that contain data inside in non-INI format and and this way you can edit in a small text editor frame at the bottom of the app.
When the user clicks on a section at the treeview, the top-right panel will display all recognizable keys/values on the top-right panel and display the raw text of the section at the bottom.
-----
At the moment - when a user clicks on a key/value of this top-right panel, the bottom-right panel will display all recognizable key/values inside the text file that contain the selected key name.
-------
Please explainOn the first example you mention
[SCSI]
atapi="IDE CD-ROM (ATAPI 1.2)/PCI IDE Controller"
1 - Should this app search for all occurences of "atapi" inside the text file and display all recognizable key/values?
2 - Or should it try to find any of the keywords "atapi" or "IDE" or "CD-ROM" or "(ATAPI" or "1.2)/PCI" or "IDE" or "Controller"?
In order to output:
[ScsiClass.Load]
[HardwareIdsDatabase] *PNP0600 "atapi"
[BusExtenders] aliide "ALI IDE Bus Driver",files.aliide,aliide
[BusExtenders] cmdide "CMD IDE Bus Driver",files.cmdide,cmdide
[BusExtenders] intelide "Intel IDE BUS Driver",files.intelide,intelide
[BusExtenders] pciide "PCI IDE Bus Driver",files.pciide,pciide
[BusExtenders] toside "Toshiba IDE Bus Driver",files.toside,toside
[BusExtenders] viaide "VIA IDE Bus Driver",files.viaide,viaide
[BusExtenders.Load] aliide aliide.sys
[BusExtenders.Load] cmdide cmdide.sys
[BusExtenders.Load] intelide intelide.sys
[BusExtenders.Load] pciide pciide.sys
[BusExtenders.Load] toside toside.sys
[BusExtenders.Load] viaide viaide.sys
Please let me know how it would work best for you.
-----------------
...having beside each line a tick box that would allow to select manually the strictly related items and save these as a "set" of interconnected items, possibly in a .ini file, re-usable and exchangeable, would be great, I guess that in a very short time, with the contributions of a few members we could have a number of "sets" to be used instead of the results of the "search". (another checkbox will be needed to switch between "search mode" and "presets mode")
Please give more examples so that I can fully understand what you mean - guess this is the sort of thing that would really help to talk in person and exchange ideas pointing at the computer screen.
How should these sets be used - to they mean exporting/modifying a custom txtsetup file? (for example)
Should this set change values inside the target file?

--------
Giving priority to some sections can easily be done and it is even possible to drag and drop sections to suit your preference instead of using INI templates - please tell which you prefer if not both (to save some time)
Moreover, I would like to have the rather cryptic syntax of "commas" interpreted, maybe one could add a "Status bar" at the bottom that , whenever a key like:
Should be last step when all above are complete.
----
Peter - thanks for the code snippets - I'm not (yet) using them because I've used a treeview and associated raw data inside to sort everything up but I thank you for sharing them.