Android Question QUESTION : regarding [B4X] [XUI] AS CardSlider

rabbitBUSH

Well-Known Member
Licensed User
Anyone or @Alexander Stolte :
Its not going to be easy to create an test example for this one, so I will rely on this description for now...

The code has a page displaying record-by-record details from a database. It provides for going to another B4XPage in order to edit something, save that, then return to the viewing page and continue through the list of records.

can anyone tell me if there is a way to force the values OldIndex and NewIndex (probably specifically OldIndex) to a value that you want it to be.
  • Private Sub AS_CardSlider1_PageChanged(OldIndex As Int, NewIndex As Int)
So, for instance, if one has a page (lets call it Page1) in which the value of AS_CardSlider.Index is 0 ->then you slide off to the index 5 (card).
Now move off that page to, editPage, then return (page back button top left of a B4xPage) to Page1 from editPage the values of any fields in Page1 are preserved so that Page1 Cardslider card is still on index 5.

What I found is that if I then try to move, using the slider, to card 6 (treeAS_CardSlider1.NextPage) AS_CardSlider1_PageChanged is confused about the index and the row in the database it should be on.

Logging OldIndex and NewIndex shows those values to be 0 and 1, in other words its assumed going back to the first card after the return from editPage.

I thought setting the AS_CardSlider1.Tag value would work but I don't think that this would be preserved from page change to page change; and, where to read it back and set OldIndex to that value, seems challenging. Or, to use AS_CardSlider1.SetIndex to set the value of the slider in the button clicks where NextPage or PreviousPage are called?
 
Top