ListView Scroll Position doesn't work first time

Hi, all! :slightly_smiling_face:

I’m using a List View that has 65 items. I’m trying to set the initial position to 45th item.

The first time I select the ListView, it shows from position 1. So I select an item and then select the ListView again and it shows from position 45 as desired. :thinking:

Why won’t it, or how can I get it to scroll to position 45 initially? I’ve set the position in 3 or 4 places in my codes, no joy. :disappointed:

Screenshot from 2020-11-22 13-55-52

Any help is greatly appreciated! :grin:

You probably need to give the listview time to load everything. Add a clock timer to call the scroll handler after 250 millis (adjust as necessary) to see if that helps…

1 Like

Yep, that worked. :smiley: I started the clock timer when I pressed the button, which had to be pressed anyway. When the clock timer method ran, I set the ListView scroll position and the list immediately scrolled to the desired position; worked at 100ms, but I’ll leave it at 250ms.

Thanks for your reply and solution! :joy:

Well, it was working. :tired_face: Now I can’t get it to work. Here are
my blocks:

Screenshot from 2020-12-03 14-39-23

I’ve tried to run the clock before the initVarsMain, no joy. :unamused:

Set the timer interval BEFORE enabling the timer
Then you can adjust the interval to find the amount of time needed.
1000 msec should be enough.

You may need to do some of this inside your initVarsMain procedure ?

Sorry I didn’t reply earlier. :disappointed:

Setting the timer interval before enabling the timer works way’mo better. Thanks! :sunglasses:

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