Feb 16, 2017 Replies: 1 Often a Scrollview doesn't scroll as you expect when you add a lot of views to it and then want to scroll it to the last added view. It seems as the message isn't properly handled because the system is still busy with the SV itsself. The following code works for me. Just put the Scroll command to another sub and call it with "CallSubDelayed2". Code: Sub AddManyViewsToASrollView 'add a lot of views in a loop CallSubDelayed2(Me,"Scroll2Pos",SV.Panel.Height) 'scrolls to the panel height = last added view End Sub Sub Scroll2Pos (pos As Int) SV.ScrollPosition=pos 'SV is defined in globals End Sub Of course you can change the code and call the sub with the SV as a parameter to make it more flexible. Click to expand...
Often a Scrollview doesn't scroll as you expect when you add a lot of views to it and then want to scroll it to the last added view. It seems as the message isn't properly handled because the system is still busy with the SV itsself. The following code works for me. Just put the Scroll command to another sub and call it with "CallSubDelayed2". Code: Sub AddManyViewsToASrollView 'add a lot of views in a loop CallSubDelayed2(Me,"Scroll2Pos",SV.Panel.Height) 'scrolls to the panel height = last added view End Sub Sub Scroll2Pos (pos As Int) SV.ScrollPosition=pos 'SV is defined in globals End Sub Of course you can change the code and call the sub with the SV as a parameter to make it more flexible.
Erel B4X founder Staff member Licensed User Longtime User Feb 17, 2017 #2 Another option is to use ScrollView.ScrollToNow.