B4J Question [abmaterial] Theme for Lists

David Elkington

Active Member
Licensed User
Longtime User
Hi,

I am having trouble adjusting the colours etc on ABMList objects in my app. I know that it is seeing something as the .colorize setting seems to make a difference, but I cannot seem to make anything else stick, help would be appreciated... My code is as follows

B4X:
MyTheme.AddListTheme("GTList")
    MyTheme.List("GTList").Colorize(ABM.COLOR_GREEN)
    
    MyTheme.List("GTList").ItemBackColor=ABM.COLOR_GREEN
    MyTheme.List("GTList").ItemActiveColor=ABM.COLOR_GREEN
    MyTheme.list("GTList").ItemActiveColorIntensity=ABM.INTENSITY_LIGHTEN4
    MyTheme.List("GTList").SubItemBackColor=ABM.COLOR_BLUE
    MyTheme.List("GTList").BackColorIntensity=ABM.INTENSITY_LIGHTEN4

I am adding items with the theme bit too as below, but it does not seem to do anything except for the colorize.

B4X:
listemp.AddItemwiththeme("H" & rs.getint("stf_ID"), ListTopLevel("L1H1","mdi-action-account-circle",rs.Getstring("name") & strTL & " (Left)","dot_red","Expired","dot_green","Valid"),"gtlist")
 

alwaysbusy

Expert
Licensed User
Longtime User
it shouldn't make a difference, but if you could just try it to see if it is not a bug:

Make the themename lowercase everywhere, e.g.:
B4X:
    MyTheme.AddListTheme("gtlist")
    MyTheme.List("gtlist").Colorize(ABM.COLOR_GREEN)
    
    MyTheme.List("gtlist").ItemBackColor=ABM.COLOR_GREEN
    MyTheme.List("gtlist").ItemActiveColor=ABM.COLOR_GREEN
    MyTheme.list("gtlist").ItemActiveColorIntensity=ABM.INTENSITY_LIGHTEN4
    MyTheme.List("gtlist").SubItemBackColor=ABM.COLOR_BLUE
    MyTheme.List("gtlist").BackColorIntensity=ABM.INTENSITY_LIGHTEN4
 
Upvote 0

David Elkington

Active Member
Licensed User
Longtime User
Yes, I did try changing it all to lower case beforehand, but it does not make a difference. I have used the theme stuff very successfully everywhere else, but lists just don't seem to budge.
 
Upvote 0

David Elkington

Active Member
Licensed User
Longtime User
Yes, my ListTopLevel is a container as below

B4X:
Sub ListTopLevel(id As String, icon As String, Title As String,strwebcolour1 As String,txtTooltip1 As String,strwebcolour2 As String,txtTooltip2 As String) As ABMContainer
    Dim itemcont As ABMContainer
    itemcont.Initialize(page, id,"")   
       itemcont.AddRowsM(1,False,0,0, "").AddCellsOSMP(1,0,0,0,8,8,8,0,0,15,0,"").AddCellsOSMP(1,0,0,0,3,3,3,0,0,0,0,"").AddCellsOSMP(1,0,0,0,1,1,1,0,0,15,0,"")
      
    itemcont.BuildGrid '//IMPORTANT once you loaded the complete grid And before you start adding components
    
    Dim dotcont As ABMContainer
    dotcont.Initialize(page, id & "dot","")
    dotcont.AddRowsM(1,False,0,0, "").AddCellsOSMP(2,0,0,0,6,6,6,20,0,0,0,"")
    dotcont.BuildGrid
    
    itemcont.Cell(1,3).AddComponent(dotcont)
    
    If strwebcolour1<>"None" Then
        
        If strwebcolour2="None" Then
            Dim lblspacedot As ABMLabel
            lblspacedot.Initialize(page,"spcdot"," ",ABM.SIZE_H6,True,"")
            dotcont.Cell(1,1).AddComponent(lblspacedot)
        End If
        
        Dim btnstat1 As ABMButton
        btnstat1.InitializeFloating(page,"stat1" & id,"",strwebcolour1)
        btnstat1.SetTooltip(txtTooltip1,ABM.TOOLTIP_LEFT,1000)
        btnstat1.Size=ABM.SIZE_SMALL
        dotcont.Cell(1,2).AddComponent(btnstat1)
    End If
    
    If strwebcolour2<>"None" Then
        
        Dim btnstat2 As ABMButton
        btnstat2.InitializeFloating(page,"stat2" & id,"",strwebcolour2)
        btnstat2.SetTooltip(txtTooltip2,ABM.TOOLTIP_LEFT,1000)
        btnstat2.Size=ABM.SIZE_SMALL
        dotcont.Cell(1,1).AddComponent(btnstat2)
    End If
    
    
    Dim lbl As ABMLabel
    If icon <> "" Then
        lbl.Initialize(page, id, Title, ABM.SIZE_H6, True, "header")
    Else
        lbl.Initialize(page, id, Title, ABM.SIZE_H6, True, "")
    End If
    lbl.VerticalAlign = True
    lbl.IconName = icon
    
    itemcont.Cell(1,1).AddComponent(lbl)
    
    Dim lblspacemid As ABMLabel
    lblspacemid.Initialize(page,"spcmid"," ",ABM.SIZE_H6,True,"")
    itemcont.Cell(1,2).AddComponent(lblspacemid)
    
    Return itemcont
End Sub

The screenshot of the list is as attached. As you can see it is quite complex, and getting more so as I learn how to leverage this wonderful framework. Whatever I change on the theme, does not reflect on the list, even when I was using BuildSimpleItem.
 

Attachments

  • Screenshot 2018-10-29 at 16.08.13.png
    Screenshot 2018-10-29 at 16.08.13.png
    368.2 KB · Views: 225
Upvote 0

Harris

Expert
Licensed User
Longtime User
I am having trouble adjusting the colours etc on ABMList objects in my app.

After a previous question posted about ABMList, I have been testing it out to help with the question(have not had a need to use it in my apps).

Setting themes - or list item themes appears to be an issue. Seems defined themes are essentially ignored. ???
 
Upvote 0

David Elkington

Active Member
Licensed User
Longtime User
At least we know there is an issue. I spent a couple of hours trying everything and thought I was going mad.

The colorize part works though.
 
Upvote 0

David Elkington

Active Member
Licensed User
Longtime User
Yes that was in my original post reply to AB....

B4X:
MyTheme.AddListTheme("GTList")
MyTheme.List("GTList").Colorize(ABM.COLOR_GREEN)
 
Upvote 0
Top