If to use (crossplatformerly) a multiline textview for loooooooooooong log texts - how to arrange option not_to_scroll, to preserve the current scroll position, continue adding ?
Like log in B4X IDE interface.
I'm ready to add a checkbox "Scrolling" that makes force scroll down.
But question is to preserve the position.
Which textview are you referring to, an EditText, a TextArea, a Textfield, ...?
Here's some sample code for the B4J TextArea:
B4J TextArea scroll:
Private Sub add_log(txt As String, upper As Boolean, withcrlf As Boolean)
logcnt = logcnt + 1
If upper Then txt = txt.ToUpperCase
If withcrlf = True Then
ta1.Text = ta1.Text & txt & CRLF
Else
ta1.Text = ta1.Text & txt
End If
Sleep(100)
ta1.ScrollTopPosition = logcnt * 30
End Sub
Other textviews might not have a method similar to the ScrollTopPosition method.
B4X IDE logs is made of a control similar to CLV. Each line is a separate item.
1. The IDE removes the top 1000 items when the size > 5000.
2. When a new item is added the IDE checks the current scroll position. If it is near the bottom then it is in "auto scroll" mode. Otherwise the scroll position isn't touched.