Return to last position on list (+1) after remove a item

Hi
I'm building an application where I have a list whose items are removed and inserted into another list.
After the result the list returns to the initial view showing the first item.
In this case, the user has to go through the list again until he finds the point he stopped before.
I'm trying to position the cursor on the next item (or previous),in the list after the other item is deleted.
I'm not succeeding with the knowledge I have, but I suppose I have to work with index.
I already store the index of the deleted item in a lastIndex variable but I don't know how to position the list in the lastIndex+1 or in lastIndex-1, for example.
Thanks for helping...

Show your relevant blocks and screen

Item at LastIndex-1 =

select list item
|
--> global list
     length of listglobal list- 1

Use a Plus operator for LastIndex+1, which will throw an error btw.

solved. Tank you

If you want the listview to actually scroll to the lastIndex, then a bit more work is required.

First off, get and install @vknow360 's Scroll Handler extension

Drag out a Vertical Scrolling Arrangement(VSA) and place the listview inside it. The list view will need a fixed/set height, which is less than the set/fixed height of the VSA. (set/fixed in both cases means pixels, not percentages or fillparent/automatic). Then assuming the height of a single listview element is 44 pixels, use blocks like this:

Then when you set the Listview1.SelectionIndex (in the above image set to 27 with your lastIndex the listview will scroll to that place.

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.