TListView positioning

I have a TListview in vsReport mode which I rebuild after certain events. I would like to be able to keep the top item the same after rebuilding.

I can get the TopItem.Index but cannot figure out how to make this index the top item again after the rebuild. The count never changes between rebuilds so I am not worried about the item not existing.

Any ideas?

Maybe you could do this by scrolling to the bottom most item then using ‘makevisible’ on the list item you want at the top.

I can’t see any API functions from LVM_SETITEM message (Commctrl.h) - Win32 apps | Microsoft Learn that claim to work in Report mode.

Yes, that may work, I’ll give it a go. Force the last item to be visible then the top item…

Seems odd to me that you can get the topmost item but can’t set it.

~WRD0622.jpg