Hi to Everybody
I have a strange situation, using a ScrollView. The following code worked in the past. Now I am trying to re-use it and the scrollview that I used, doesn't scroll automatically. The ScrollView is named "Lista" and is defined in the designer (with internal height 500, the default). The sub assumes a global iRow counter that is sequentially incremented by other operations.
In my case, I have 23 nRow. Initially pos is negative, but also when it becomes positive (adding rows, incrementing iRow), the ScrollView doesn't scroll up...BUT, as I said, such code worked in other Apps and I don't figure out what is now happening or what I am missing..
Thanks in advance for any hint.
I have a strange situation, using a ScrollView. The following code worked in the past. Now I am trying to re-use it and the scrollview that I used, doesn't scroll automatically. The ScrollView is named "Lista" and is defined in the designer (with internal height 500, the default). The sub assumes a global iRow counter that is sequentially incremented by other operations.
B4X:
Sub AddLineToList
Dim Row As Panel
Dim pos As Int
Dim RowHeight,nRowPage As Int
RowHeight=26dip
nRowPage=Lista.Height/RowHeight
Row.Initialize("")
'.....
' Row is filled by other Views that I omit to avoid confusion
' then Row is added to the Lista.Panel at iRow-1 position
Lista.Panel.AddView(Row,1,2dip+(iRow-1)*(RowHeight) ,Lista.Width-6,RowHeight)
pos=RowHeight*(iRow-nRowPage+1)
If pos>0 Then
Lista.ScrollPosition=pos ' doesn't work ... nothing happens .
End If
End Sub
Thanks in advance for any hint.