Android Question b4xtable color the text of single lines

Angelo Messina

Active Member
Licensed User
Longtime User
Hello everyone
do you know how in a b4xtable color the text of single lines, assigning the color according to the origin of the data?

thank you
 

jimmyF

Active Member
Licensed User
Longtime User
do you know how in a b4xtable color the text of single lines, assigning the color according to the origin of the data?
For the full row you may need to do this for each cell in the row.
(Build whatever conditions in there that you need.)
This will handle individual cells in the B4XTable1_DataUpdated sub:
B4X:
For i = 0 To B4XTable1.VisibleRowIds.Size - 1
            Dim RowId As Long = B4XTable1.VisibleRowIds.Get(i)
            If RowId > 0 Then
                Dim pnl As B4XView = onumberColumn.CellsLayouts.Get(i + 1) '+1 because the first cell is the header
                Dim row As Map = B4XTable1.GetRow(RowId)
                Dim clr As Int
                Dim OtherColumnValue As String = row.Get(delveredColumn.Id)
                If OtherColumnValue.StartsWith("0") Then clr = xui.Color_Red Else clr = xui.Color_Black
                pnl.GetView(0).TextColor = clr
            End If
        Next
 
Upvote 0

jimmyF

Active Member
Licensed User
Longtime User
onumberColumn
delveredColumn.Id
Sorry. I did not give enough detail.
In Class_Globals
B4X:
Private onumberColumn As B4XTableColumn
Private delveredColumn As B4XTableColumn
In Sub Initialize:
B4X:
    onumberColumn = B4XTable1.AddColumn("ONum", B4XTable1.COLUMN_TYPE_TEXT)
    onumberColumn.Width = 60dip

delveredColumn = B4XTable1.AddColumn("Delivered", B4XTable1.COLUMN_TYPE_TEXT)
    delveredColumn.Width=45dip
 
Upvote 0
Top