Earlier this year I got sick of repeating the "same" code to display data for every data class I wrote. I wanted it to be as simple as:
type
TData = class
published
property Column: string read FColumn;
end;
TDataList = class(TObjectList<TData>);
...
FDataList: TDataList;
...
procedure TMyForm.DisplayData;
begin
ListView1.DisplayItems<TData>(FDataList);
TreeView1.DisplayItems<TData>(FDataList);
VirtualStringTree1.DisplayItems<TData>(FDataList);
end;
Generics were my key to implementing this, but the ListView code also supports collections. Rtti and TypInfo allow access to published properties. And thanks to attributes being introduced, I was able to control display format, alternative column titles, image indexes, listview grouping, hierarchical references and more.
If you're interested in simplifying data display as well (and use a compiler version that supports attributes), check
https://gitlab.com/ccrdude-pascal/firefly-ovm and give me some feedback