B4J Question [B4XPages] Multiline textview - vertical scroll position

peacemaker

Expert
Licensed User
Longtime User
Hi, All

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.
 

PaulMeuris

Active Member
Licensed User
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.
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
I mentioned crossplatformerly a multiline B4XView
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
how to arrange option not_to_scroll, to preserve the current scroll position, continue adding ?
Like log in B4X IDE interface.
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.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…