B4J Question about scrolling label

liulifeng77

Active Member
Licensed User
Longtime User
hi,
I have two questions:
1.scrolling label can't be add to mainform.rootpane,why? (I used code :mainform.rootpane.add(XXXXXXXX),error message is "type doesn't match")
2.how to change speed rate of scrolling?

any answer will be appreciated.
 

DonManfred

Expert
Licensed User
Longtime User
1. it is a customview. Use the designer to add a scrollinglabel
2. Play with the sleep-values

B4X:
Private Sub StartScrolling (p As B4XView, OriginalWidth As Float)
    taskIndex = taskIndex + 1
    Dim myIndex As Int = taskIndex
    Dim duration As Int = p.Width / WidthPerSecond * 1000
    Do While True
        p.SetLayoutAnimated(duration, -(p.Width - OriginalWidth), p.Top, p.Width, p.Height)
        Sleep(duration)
        If myIndex <> taskIndex Then Return
        Sleep(800)
        p.SetLayoutAnimated(0, 0, p.Top, p.Width, p.Height)
        If myIndex <> taskIndex Then Return
    Loop
End Sub
 
Upvote 0
Top