Bug? [SOLVED is not a bug] CustomListView's ScrollToItem function not working for me

Rubsanpe

Member
Licensed User
Hi, I'm trying to use CustomListView's ScrollToItem function to move the contents of the list to a new position. It is not working in the latest version of the CustomListView library. I have tested it in the example of the forum that uses the class instead of the library and in that case it works correctly.

Any idea where the problem might be?

I attach an example.

Rubén
 

Attachments

Last edited:

Erel

Administrator
Staff member
Licensed User
Your project uses the old and deprecated CustomListView library. You should switch to xCustomListView.
 

Rubsanpe

Member
Licensed User
Your project uses the old and deprecated CustomListView library. You should switch to xCustomListView.
Thank you for your reply, Erel. I chose badly the library in the example, in my project I am using the correct one. I upload an updated version with the latest version of xCustomListView (1.70)

Rubén
 

Attachments

Erel

Administrator
Staff member
Licensed User
You are seeing the behavior of the native ScrollView. It's layout is not immediately ready. Add Sleep(0) and it will work. For further discussion please start a new thread in the questions forum.
 

klaus

Expert
Licensed User
Add Sleep(0) before calling ScrollToItem.
B4X:
Sleep(0)
CustomListView1.ScrollToItem(20)
Why do you use the legacy debugger and not the 'standard' rapid debugger?
 

Rubsanpe

Member
Licensed User
You are seeing the behavior of the native ScrollView. It's layout is not immediately ready. Add Sleep(0) and it will work. For further discussion please start a new thread in the questions forum.
Thank you Erel. My first tests were putting Sleep in the code but I put it after calling ScrollToItem. Now it's working.

Klaus in the example im using the default debuger options and it is not using the legacy debugger

Thank you for your responses.

Rubén
 

klaus

Expert
Licensed User
How do you know it? It is not a project setting.
I got a message, and thought that it was a project setting and not an IDE setting.
I answered in a thread about the legacy debugger, set it and didn't remove it.
 
Top