Android Question B4xTable font color question

park jae hyun

Member
Licensed User
Longtime User
hello
I want to color the text in B4xTable

B4X:
Do While rs.NextRow
            Dim row(3) As Object
        
            row(0) = rs.GetDouble("Cday")     
            row(1) = rs.GetString("CdayWeek")

                        if rs.GetString("CdayWeek") = "mon" then
                              'font color      '---------->
                        else if rs.GetString("CdayWeek") = "Tu" then
                              'font color     '----------->
                        else
                             'font color     '----------->
                        end if 
            
            row(2) = rs.GetString("C_memo")   

            Data.Add(row)
        Loop
 

Mahares

Expert
Licensed User
Longtime User
I want to color the text in B4xTable
You need to do it after you set up the data in the table and in the DataUpdated sub:
B4X:
Sub B4XTable1_DataUpdated
    For Each c As B4XTableColumn In B4XTable1.Columns
        If c.Id= "Cdayweek" Then  'or whatever header you have
            For i = 1 To c.CellsLayouts.Size - 1
                Dim pnl As B4XView = c.CellsLayouts.Get(i)
                Dim lbl As B4XView = pnl.GetView(0)
                If lbl.Text.Contains("mon") Then
                    lbl.TextColor =xui.Color_Blue
                else If lbl.Text.Contains("tue") Then
                    lbl.TextColor =xui.Color_Red
                Else
                    lbl.TextColor =xui.Color_Black
                End If
            Next
        End If
    Next    
End Sub
You can probably use B4XFormatter as another way to do it.
 
Upvote 0
Top