It depends a bit on wether you want to enhance the TStrings more and/or want to go for Unicode ones in the future.
For consitency it would be nice to overload existing methods in TStrings so option 2. For shorter code option 1 would be better and you would keep the original TStrings as they are.
If you intent to do more enhancements I certainly would go for 2) and subclass TStrings. For possible enhancements you could also have a look at TStringList (I always use those).
You would have to make the TNxStrings public too so it's accessible as a class on it own.
Enhancements I could imagine are:
- Delete with a Start/End parameter (to delete more than one line at once).
- Easy Image support using Object underneath so you can have logging fields where each line has a image in column 0.
- Support for Virtual text (where you have to supply it in en event handler when needed)
- Sorting on Names and or Values
Privately for example I enhanced the TIniFile this way to make Read/WriteFloat more resistant to decimal separator changes and unified support for memory inifiles, diskbased ones, application one (autonaming) and external ones. And I'm quite happy with it.
I will add it. Can you please only tell me what will be better:
1) Adding this procedure to every control (such as NxMemo), or
2) Inheriting own class like TNxStrings = class(TStrings) and adding this method. Then change TStrings inside components with it with TNxStrings.
G.W. van der Vegt