B4J Question [ABMaterial] Table cell theme name

PatrikCavina

Active Member
Licensed User
Why if I set the theme name of a cell in an ABMTable in "aRow1", the theme doesn't work?

Example that doesn't work:

B4X:
public Sub BuildTheme()
    ' start with the base theme defined in ABMShared
    theme.Initialize("pagetheme")
    theme.AddABMTheme(ABMShared.MyTheme)

    ' add your specific page themes
    
    theme.AddTableTheme("tblTheme")
    theme.Table("tblTheme").ZDepth = ABM.ZDEPTH_1
    theme.Table("tblTheme").BackColor = ABM.COLOR_WHITE
    theme.Table("tblTheme").AddCellTheme("aRow1")
    theme.Table("tblTheme").Cell("aRow1").BackColor = ABM.COLOR_BLUEGREY
    theme.Table("tblTheme").Cell("aRow1").BackColorIntensity = ABM.INTENSITY_LIGHTEN4
    theme.Table("tblTheme").Cell("aRow1").ActiveBackColor = ABM.COLOR_GREEN
    theme.Table("tblTheme").Cell("aRow1").ActiveBackColorIntensity = ABM.INTENSITY_LIGHTEN1
    theme.Table("tblTheme").AddCellTheme("aRow2")
    theme.Table("tblTheme").Cell("aRow2").BackColor = ABM.COLOR_WHITE

End Sub

Private Sub pagination_PageChanged(OldPage as Int, NewPage As Int)

'
'
'
    Dim rs As ResultSet = Query
    Do While rs.NextRow
        Dim row As List = Array As String(rs.GetInt("ID"), rs.GetString("Field1"), rs.GetString("Field2"), rs.GetString("Field3"))
        Dim rowTheme As List
        rowTheme.Initialize
        If alt Then
            rowTheme.AddAll(Array As String("aRow1", "aRow1", "aRow1", "aRow1"))
        Else
            rowTheme.AddAll(Array As String("aRow2", "aRow2", "aRow2", "aRow2"))
        End If
        alt = Not(alt)
        table.AddRow("uid" & c, row)
        table.SetRowThemes(rowTheme)
        c = c + 1
    Loop

'
'
'

End Sub

Example that works:

B4X:
public Sub BuildTheme()
    ' start with the base theme defined in ABMShared
    theme.Initialize("pagetheme")
    theme.AddABMTheme(ABMShared.MyTheme)

    ' add your specific page themes
   
    theme.AddTableTheme("tblTheme")
    theme.Table("tblTheme").ZDepth = ABM.ZDEPTH_1
    theme.Table("tblTheme").BackColor = ABM.COLOR_WHITE
    theme.Table("tblTheme").AddCellTheme("alt1")
    theme.Table("tblTheme").Cell("alt1").BackColor = ABM.COLOR_BLUEGREY
    theme.Table("tblTheme").Cell("alt1").BackColorIntensity = ABM.INTENSITY_LIGHTEN4
    theme.Table("tblTheme").Cell("alt1").ActiveBackColor = ABM.COLOR_GREEN
    theme.Table("tblTheme").Cell("alt1").ActiveBackColorIntensity = ABM.INTENSITY_LIGHTEN1
    theme.Table("tblTheme").AddCellTheme("alt2")
    theme.Table("tblTheme").Cell("alt2").BackColor = ABM.COLOR_WHITE

End Sub

Private Sub pagination_PageChanged(OldPage as Int, NewPage As Int)

'
'
'
    Dim rs As ResultSet = Query
    Do While rs.NextRow
        Dim row As List = Array As String(rs.GetInt("ID"), rs.GetString("Field1"), rs.GetString("Field2"), rs.GetString("Field3"))
        Dim rowTheme As List
        rowTheme.Initialize
        If alt Then
            rowTheme.AddAll(Array As String("alt1", "alt1", "alt1", "alt1"))
        Else
            rowTheme.AddAll(Array As String("alt2", "alt2", "alt2", "alt2"))
        End If
        alt = Not(alt)
        table.AddRow("uid" & c, row)
        table.SetRowThemes(rowTheme)
        c = c + 1
    Loop

'
'
'

End Sub

Maybe i can't see the error but i can't find it if exists. Codes are the same, only changes the name from "aRow1", "aRow2" to "alt1", "alt2".

Someone can explain where is the problem?
Thanks in advance
 

alwaysbusy

Expert
Licensed User
Longtime User
just for a test, what happens if you change all the 'aRow's to 'arow's (lowercase).

Or maybe just first try to only change it in the AddAll's:

B4X:
If alt Then
    rowTheme.AddAll(Array As String("arow1", "arow1", "arow1", "arow1"))
Else
    rowTheme.AddAll(Array As String("arow2", "arow2", "arow2", "arow2"))
End If

if that works, then there is a bug in AddAll (As ABM should always lowercase everything internally, just like B4J works).
 
Upvote 0
Top