Hi,
I'm trying to set the scroll position to the last (down) of the content.. but when I try with something like this..
scrollPanel.ScrollTo(0, scrollPanel.Panel.Height,False)
It does not work as it should.
Is like a chat, if I send a message I need to scroll to the last message.. so when the user click on the txtbox, y upload the panel that contains this txtbox and reduce the scrollview.height, then restore.. the problem is that i can obtain the scroll at last message.
(A curious error, apparently if it does but I must touch the scroll to appear, but .. nothing is displayed on the scroll. (It's like a time error, that's why I tried sleep, but neither))
I'm trying to set the scroll position to the last (down) of the content.. but when I try with something like this..
scrollPanel.ScrollTo(0, scrollPanel.Panel.Height,False)
It does not work as it should.
Is like a chat, if I send a message I need to scroll to the last message.. so when the user click on the txtbox, y upload the panel that contains this txtbox and reduce the scrollview.height, then restore.. the problem is that i can obtain the scroll at last message.
(A curious error, apparently if it does but I must touch the scroll to appear, but .. nothing is displayed on the scroll. (It's like a time error, that's why I tried sleep, but neither))
B4X:
Sub pg_KeyboardStateChanged (Height As Float)
If varHeight=0 Then
If Height>0 Then varHeight= Height
End If
If Height = 0 Then
'pg.RootPanel.Top = 0
scrollPanel.Height = scrollPanel.Height + varHeight
inputPanel.Top = inputPanel.Top + varHeight 'varHeight
Else
For Each V As View In pg.RootPanel.GetAllViewsRecursive
If IsFirstResponder(V) Then
inputPanel.Top = inputPanel.Top - Height
scrollPanel.Height = scrollPanel.Height - Height
'pg.RootPanel.Top = Height *-1
End If
Next
End If
inputPanel.BringToFront
'scrollPanel.ScrollOffsetY = scrollPanel.Panel.Height
'scrollPanel.ScrollOffsetY =0
'scrollPanel.ScrollOffsetY = scrollPanel.ContentHeight
'Sleep(500)
'scrollPanel.ScrollTo(0,lastMessageY,True)
'scrollPanel.ScrollOffsetY = lastMessageY
'Sleep(1000)
'scrollPanel.ScrollTo(0, scrollPanel.Panel.Height,False)
End Sub