Wish [B4X] [XUI] xCustomListView minor change

Andrew (Digitwell)

Well-Known Member
Licensed User
Can I request the following minor change.

B4X:
Private Sub CreateLabel(txt As String) As B4XView
    Dim lbl As Label
    lbl.Initialize("")
    lbl.TextAlignment = DesignerLabel.TextAlignment
    lbl.Font = DesignerLabel.Font
    lbl.Multiline = True
    lbl.Text = txt
    lbl.Width = sv.ScrollViewContentWidth - 10dip
    lbl.SizeToFit
    Return lbl
End Sub

to

B4X:
Private Sub CreateLabel(txt As Object) As B4XView ' a change to the type
    Dim lbl As Label
    lbl.Initialize("")
    lbl.TextAlignment = DesignerLabel.TextAlignment
    lbl.Font = DesignerLabel.Font
    lbl.Multiline = True
    lbl.attributedText = txt ' a change to the assigned string
    lbl.Width = sv.ScrollViewContentWidth - 10dip
    lbl.SizeToFit
    Return lbl
End Sub

So that I can use CSbuilder strings in the CustomListView AddTextItem.
Thanks
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
The correct code is:
B4X:
Private Sub CreateLabel(txt As Object) As B4XView
   Dim lbl As Label
   lbl.Initialize("")
   lbl.TextAlignment = DesignerLabel.TextAlignment
   lbl.Font = DesignerLabel.Font
   lbl.Multiline = True
   If txt Is AttributedString Then
       lbl.AttributedText = txt
   Else
       lbl.Text = txt
   End If
   lbl.Width = sv.ScrollViewContentWidth - 10dip
   lbl.SizeToFit
   Return lbl
End Sub

I will update it.
 
Top