@GetMem, yes, that's exactly what i meant. And yes, the sample looks crazy. But it shows up a problem. And in practice the programs are far more complex and there is a dependency of functions .... and not everybody has s navigator builtin for to decide which place is a good one and which one is bad. Should me or other redesign programs only because the technique of GetSelection had changeed?
@wp, right, without icons it's much faster, but not even close as it had been before;
in my app it would go down from7000 ms onto 680ms. Previously (before the for-loop) it had been 110 ms).
I didn't suspect the runtime of the for-loop itself (it's by far not as long), but i thought, maybe all objects would initialize at once now, conflicting the virtual paradigm.
One might omit the icons (however, won't like to do omit them), but there're also more data to fetch and prepare within the OnData callback.
Argement pro the theory:
i applied a Counter within "OnData".
Clicking on node "system32", it says: 4765 calls of SLVOnData.
Without the line "if SLV.Selected = nil then xyz:='dummy'" it says: 0 (! womehow strange ..) calls of SLVOnData.
So i believe that the for-loop within the GetSelection might kill the virtual paradigm, when - unluckywise - the "if Select" is done from a "wrong place".
Just besides (because of course not applicable for cross platform):
i looked was Delphi 7 had done at "GetSelected". At the end it calls (Windows API) ListView_GetNextItem(
with the flags 'LVNI_ALL or LVNI_SELECTED', where, maybe of interest;
https://docs.microsoft.com/en-us/windows/win32/api/commctrl/nf-commctrl-listview_getnextitemLVNI_ALL - Searches for a subsequent item by index, the default value.
@Juha: i know my limits here. I've a lot of respect for the complexity of Lazarus and the expertise and experience of the collegues here, it's unbelievable. With my two or three little apps i'm just at my boundaries.