Android Question b4xtable color the text of single lines

Discussion in 'Android Questions' started by Angelo Messina, May 31, 2019.

  1. Angelo Messina

    Angelo Messina Active Member Licensed 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
     
  2. jimmyF

    jimmyF Active Member Licensed User

    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:
    Code:
    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
     
    Angelo Messina and DonManfred like this.
  3. Angelo Messina

    Angelo Messina Active Member Licensed User

    What are :
    onumberColumn
    delveredColumn.Id
     
  4. jimmyF

    jimmyF Active Member Licensed User

    Sorry. I did not give enough detail.
    In Class_Globals
    Code:
    Private onumberColumn As B4XTableColumn
    Private delveredColumn As B4XTableColumn
    In Sub Initialize:
    Code:
    onumberColumn = B4XTable1.AddColumn("ONum", B4XTable1.COLUMN_TYPE_TEXT)
        onumberColumn.Width = 
    60dip

    delveredColumn = B4XTable1.AddColumn(
    "Delivered", B4XTable1.COLUMN_TYPE_TEXT)
        delveredColumn.Width=
    45dip
     
    Erel and mangojack like this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice