Android Question CSBuilder and ScrollingText

mmieher

Active Member
Licensed User
Longtime User
I am probably doing this wrong, but I cannot seem to change the color of a word in the middle of a label used in ScrollingLabels (ScrollingText lib). The following produces all gray -- no red.

B4X:
'    Build ScrollText from Work Orders ----------------------------------------------------
    WOList.Initialize
    WOMap.Initialize
    SQLText = "SELECT * FROM wolist ORDER BY wrkordnbr DESC "
    WOList = DBUtils.ExecuteMemoryTable(SQL1,SQLText,Null,0)
   
    Dim i As Int = WOList.Size
   
    If i = 0 Then Return
   
    ScrollText = ""
    Dim cs As CSBuilder
    cs.Initialize
   
    For i = 0 To WOList.Size - 1
        WORecord = WOList.Get(i)
        MapWORecord
        ScrollText = cs.Color(Colors.Gray).Append("      WO " & WOMap.Get("wrkordnbr") & " ")
        If s.Val(WOMap.Get("priority")) = 0 Then
            ScrollText = cs.Color(Colors.Red).Append("URGENT ")    '    does not work
        End If
       
        ScrollText = cs.Append(WOMap.Get("servsitename"))
    Next
    ScrollText = cs.Append("").PopAll
   
    '    Start Scrolling ----------------------------------------------------------------------
   
    Greeting.Visible = False
   
    Dim ScrollingLabels As ScrollingText
    Dim slGreeting As Label
   
    ScrollingLabels.Initialize
    slGreeting.Initialize("")
'    slGreeting.TextColor = Colors.Gray
    slGreeting.TextSize = 20
   
    Activity.AddView(slGreeting,20dip,10dip,570dip,50dip)
   
    ScrollingLabels.StartScrolling(slGreeting,ScrollText,True,2,Null,Colors.RGB(248,248,255))
 

Mahares

Expert
Licensed User
Longtime User
I think you need to initialize CS inside the loop every time:
B4X:
For i = 0 To WOList.Size - 1
        WORecord = WOList.Get(i)
        MapWORecord
        CS.Initialize
 
Upvote 0

mmieher

Active Member
Licensed User
Longtime User
Thank you, Mahares, but the result moving the cs.initialize is that I only have the first record in ScrollText. I am trying to build a big string ticker tape of all the record descriptions.
 
Upvote 0
Top