Badges can notify you that there are new or unread messages or notifications.

  • Mom

    2

  • Dad

    7

  • Brother

  • Sister

    3

Click on the list item to 'read' the messages. You'll notice the badge changing from 'new' to 'normal' state. Click on the button below to add 'new' messages to Brother. You'll notice the badge state changing from 'normal' to 'new'.

// create list
Dim list1 As ABMList
list1.Initialize(page, "list1", ABM.COLLAPSE_ACCORDION, "")

// add items
list1.AddItem("S1", BuildItem("S1", "Mom", "2", False))
list1.AddItem("S2", BuildItem("S2", "Dad", "7", True))
list1.AddItem("S3", BuildItem("S3", "Brother", "", False))
list1.AddItem("S4", BuildItem("S4", "Sister", "3", False))
Sub BuildItem(id As String, text As String, messages As String, isnew As Boolean) As ABMContainer
   Dim ItemCont As ABMContainer
   ItemCont.Initialize(page, id, ")	
   ItemCont.AddRowsM(1,False,0,0, ").AddCellsOSMP(1,0,0,0,10,10,10,6,0,0,0,").AddCellsOSMP(1,0,0,0,2,2,2,6,0,0,0,")
   ItemCont.BuildGrid //IMPORTANT once you loaded the complete grid AND before you start adding components

   Dim lbl As ABMLabel
   lbl.Initialize(page, id & "lbl", text, ABM.SIZE_PARAGRAPH, False, "")
   ItemCont.Cell(1,1).AddComponent(lbl)

   Dim badge As ABMBadge
   badge.Initialize(page, id & "badge", messages, isnew, "")
   ItemCont.Cell(1,2).AddComponent(badge)

   Return ItemCont
End Sub

The events when someone clicks on the list item to 'read' the messages and the button code to add a new message to brother.

Sub list1_Clicked(ItemId As String)
   // get the list component from the page
   Dim list1 As ABMList = page.Component("List1")
   // get the item
   Dim cont As ABMContainer = list1.Item(ItemId)
   // get the badge control
   Dim badge As ABMBadge = cont.Component(ItemId & "Badge")
   badge.IsNew = False	

   badge.Refresh ' IMPORTANT
End Sub
Sub btn1_Clicked(Target As String)
   // get the list component from the page
   Dim list1 As ABMList = page.Component("List1")
   // get the third item (brother)
   Dim cont As ABMContainer = list1.Item("S3")
   // get the badge control
   Dim badge As ABMBadge = cont.Component("S3Badge")
   badge.IsNew = True
   NewMsg = NewMsg + 1
   badge.Text = NewMsg
   badge.Refresh ' IMPORTANT
End Sub