I have a listView that is populated every 1/2 sec and when I set the TopItem to an ListItem whose index > visible items, then the list jumped between the topItem and back 2 spots.
To correct the problem, I set the TopIterm AFTER the call to EndUpdate as shown in this code snippet:
1: lvB.EndUpdate();
2: lvI.EndUpdate();
3: lvR.EndUpdate();
4:
5: if (lstEntryInts.Items.Count > 0) lstEntryInts.TopItem = lstEntryInts.Items[iTopVisIdx];
6: if (lstEntryBools.Items.Count > 0) lstEntryBools.TopItem = lstEntryBools.Items[iTopVisIdx];
7: if (lstEntryReals.Items.Count > 0) lstEntryReals.TopItem = lstEntryReals.Items[iTopVisIdx];
8:
9: if (lstProcInts.Items.Count > 0) lstProcInts.TopItem = lstProcInts.Items[iTopProcVisIdx];
10: if (lstProcBools.Items.Count > 0) lstProcBools.TopItem = lstProcBools.Items[iTopProcVisIdx];
11: if (lstProcReals.Items.Count > 0) lstProcReals.TopItem = lstProcReals.Items[iTopProcVisIdx];
12:
13: if (lstDelvInts.Items.Count > 0) lstDelvInts.TopItem = lstDelvInts.Items[iTopDelvVisIdx];
14: if (lstDelvBools.Items.Count > 0) lstDelvBools.TopItem = lstDelvBools.Items[iTopDelvVisIdx];
15: if (lstDelvReals.Items.Count > 0) lstDelvReals.TopItem = lstDelvReals.Items[iTopDelvVisIdx];