Thanks for the example!
You're welcome.
Though, I did forgot do do something crucial in that example and that is to set the ownerdata to true (it was left out during copy-paste/cleanup).
So the key part is the ImageList with the height, I think.
You are correct.
The problem with classes that originate from (and now bound to) Windows is that all the Windows specific stuff can't be added by the LCL because the functionality might be missing for other backends.
This is one of them because Windows allows for a itemheight message to be send to the control that allows to set the height of/for an item. Adding a item or subitem that actually uses an icon with a specific width and height would usually (e.g. without using customdraw) draw that icon in the list and thus has to reserve the height and weight to be able to draw that icon. The code as shown was the quickest solution I was able to find that doesn't actually requires for the icon to be drawn but still reserves height and width (to be able to draw the icon, which is actually not drawn at all).
I'm not sure yet, if I want to go with such a hack. I hoped there is a better way to define the height. But if it works...
If you do not like such a workaround (I can imagine) then forget using any component that originates from windows and go the custom-drawn route. Though having said that, I tried to make sense out of the TCDListView component but am completely clueless as to me that component seems unfinished ?).
There might be better solutions out there as also suggested by others.
Personally I never managed to have found a list that is able to contain (a virtual amount of) custom data (it always seems to boil down to some sort of tree) except for one and that was for databases (Delphi came shipped with a panel that could be used to placed other components on top and a list that contained as many of these panels that where visible and which replicated the panel with all it contained components (and the contents of these components could be mapped to underlying database fields)). I believe it was simply named TDBPanelList (or something to that extend).
OnData and so on I don't understand, yet. My way would have been to organise the data in a list on my own and use it in OnCustomDrawItem just like you did in the example. Perhaps OnData is needed for sorting or similar things? (In my current use case I won't need any sorting).
That is why I said you probably are able to get away without using them. It is a bit complicated to implement because you 'virtually' fill a listitem with all the data that you want to have displayed and doing so by retrieving the data form your list. Using the methods allows for the data to be obtained 'on the fly' and customized any which way you want.
The example (indeed) simply maps the index from the listitem to the index of the list that contains all the data, and in our example that works perfectly. There are many circumstances in which this is not possible and you actually have to obtain the data 'on the fly'.
Thanks again, the screenshot is nice!
You're most welcome and even though I am not sure if this trick works for every widgetset (please do try and test) feell free to ask more in case you have questions.
fwiw: I am still looking for an example that properly shows how to use the ondataXXX events (as there doesn't even seem to be an example anywhere in the source-tree nor the wiki) but I'm afraid the best I would be able to come up with is the documentation from (old) Delphi that explained these kind of things into details.