I have a CListCtrl
which has about 100,000+ entries. The user is presented with a search box to search among these entries. On finding a match, I set that as a selection and scroll to it using EnsureVisible
.
This scroll happens instantaneously. I wanted to try and code an animation that looks similar to the ones demoed here (especially the 'Go Top - Easing 2' animation).
I'm thinking, for a basic animation,
- Get current selection.
- Get target selection.
- Compute difference.
- Get the pixel height of one item.
- Mutiply results of step 3 and 4.
Scroll
by an increment of 1 (or some other more optimal value) with a delay until increment = result of step 5.
I tried this and I got incredibly confused. Firstly, is my algorithm okay? Secondly, is there another, better way to achieve this (preferably similar to animation 2 in the link above)?