German Scrollview scrollt nicht automatisch ans ende

Siam

Active Member
Licensed User
Hallo,

ich versuche bei diesem Programm welches einfach einen (noch) festen Text auszugeben und nach der Ausgabe soll das Scrollview dingends einfach nach ganz unten Scrollen aber genau das will einfach nicht funktionieren :( oder ich sehe den Wald vor lauter Bäumen nicht.

B4X:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.

End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
    Dim scrollview1 As ScrollView
    Dim msg As String
    Dim strutil As StringUtils
    Dim ht As Float

End Sub

Sub Activity_Create(FirstTime As Boolean)
    scrollview1.Initialize(0)
    Activity.AddView(scrollview1,5dip,5dip,80%x,45%y)
    settext
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)
End Sub

Sub settext

    For i=0 To 10
        Dim label1 As Label
        label1.Initialize("text")
        label1.TextSize=12
        msg="testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest"
        label1.Text=msg
        scrollview1.Panel.AddView(label1,5dip,10+scrollview1.Panel.Height,70%x,20dip)
        ht =    strutil.MeasureMultilineTextHeight(label1, msg)
   
   
        label1.Height=ht   
        scrollview1.Panel.Height=scrollview1.Panel.Height+ht

        scrollview1.FullScroll(True)
Next
End Sub
 

Petrus

Member
Licensed User
Mit DoEvents geht es:

B4X:
Sub settext
 
    For i=0 To 10
        Dim label1 As Label
        label1.Initialize("text")
        label1.TextSize=12
        msg="testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest"
        label1.Text=msg
        scrollview1.Panel.AddView(label1,5dip,10+scrollview1.Panel.Height,70%x,20dip)
        ht = strutil.MeasureMultilineTextHeight(label1, msg)
        label1.Height=ht 
        scrollview1.Panel.Height=scrollview1.Panel.Height+ht +10
    Next
   
    DoEvents
    scrollview1.FullScroll(True)
   
End Sub

Gruß
Petrus
 
Top