Need to Save/Restore TListView workarea position

I am working with a TListView set to ownerdata, My only problem is when I update the item.count it resets the work area to the left/top most position, If possible I need to save/restore the current position so it is not lost when the item.count is updated. How can I do this?

Best Regards,
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Sorry but I can help you since the workarea does NOT reset when I update the item.count

BTW: I'm using Delphi 5
I haven't test, if the ListView workarea really resets, but IF it does, you can use this logic to restore the position:

Before setting the new count, ask the index of the top item that is visible (LVM_GETTOPINDEX), then ask, how many items fit on one page (LVM_GETCOUNTPERPAGE).
Then to restore the position, you should make visible (LVM_ENSUREVISIBLE) two items: The top index item and this index item: "top + countPerPage - 1". Now you should have the same scroll position as before.

Regards, Madshi.

P.S: You don't need to use these windows messages (LVM_*). All these 3 functions are encapsulated by Delphi methods, I'm just not sure about the names right now...

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
flashdAuthor Commented:
That seems to do the trick nicely.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.