iOS Question CustomListView Multiline

kozbot

Member
Licensed User
Longtime User
I'm trying to put songwords in a CustomListView, which is probably the easiest way to do it (that's also how I'm doing it in the Android version), but I'm having issue making it multiline per item. As you can imagine they need to be different lengths for different songs, so can anyone give me an idea of how to make this happen?

B4X:
Sub Show
    pg.Initialize("pg")
    pg.RootPanel.LoadLayout("svpanel3")
    Panel1.LoadLayout("songwordsshort")
    Panel1.Width = Panel1.Width - 0
    'Panel1.Height = Panel1.Height + 50dip
    Main.NavControl.ShowPage(pg)
    clv1.Initialize(Me, "clv1", 100%x)
    Panel1.AddView(clv1.AsView, 0, 0, 100%x, 80%y)
    Panel1.Color = Colors.Transparent
    clv1.DefaultTextColor = Colors.white
    clv1.DefaultTextBackgroundColor = Colors.Transparent
    pg.RootPanel.Color = Colors.Black
    pg.Title = ""
   
       clv1.Add(CreateListItem("Hark the herald angels sing,"&Chr(13)&Chr(10)&"glory To the newborn King;"&Chr(13)&Chr(10)&"Peace on earth And mercy mild,"&Chr(13)&Chr(10)&"God And sinners reconciled."&Chr(13)&Chr(10)&"Joyful all ye nations rise,"&Chr(13)&Chr(10)&"join the triumph of the skies,"&Chr(13)&Chr(10)&"With the angelic hosts proclaim,"&Chr(13)&Chr(10)&"Christ Is born in Bethlehem"&Chr(13)&Chr(10)&Chr(13)&Chr(10)&"Chorus:"&Chr(13)&Chr(10)&"Hark the herald angels sing,"&Chr(13)&Chr(10)&"Glory To the newborn King."&Chr(13)&Chr(10)&Chr(13)&Chr(10)&"Christ by highest heaven adored,"&Chr(13)&Chr(10)&"Christ the everlasting Lord."&Chr(13)&Chr(10)&"Late in time behold Him come,"&Chr(13)&Chr(10)&"offspring of the Virgin's womb."&Chr(13)&Chr(10)&"Veiled in flesh the Godhead see,"&Chr(13)&Chr(10)&"Hail the Incarnate Deity,"&Chr(13)&Chr(10)&"Pleased As Man with man To dwell,"&Chr(13)&Chr(10)&"Jesus our Emmanual.    Chorus"&Chr(13)&Chr(10)&Chr(13)&Chr(10)&"Hail the heaven born Prince of peace,"&Chr(13)&Chr(10)&"Hail the son of righteousness."&Chr(13)&Chr(10)&"Light And life To all He brings,"&Chr(13)&Chr(10)&"risen with healing in his wings."&Chr(13)&Chr(10)&"Mild, he lays His glory by,"&Chr(13)&Chr(10)&"born that man no more may die."&Chr(13)&Chr(10)&"Born To raise the sons of earth,"&Chr(13)&Chr(10)&"born To give them second birth.    Chorus", clv1.AsView.Width, clv1.AsView.Height), 100%y, 1)
End Sub

Sub CreateListItem(Text As String, Width As Int, Height As Int) As Panel
    Dim p As Panel
    p.Initialize("")
    p.Color = Colors.Black
    Dim b As Button
    b.Initialize("button", b.STYLE_SYSTEM) 'all buttons click events will be handled with Sub Button_Click
    Dim lbl As Label
    lbl.Initialize("lbl")
    lbl.TextAlignment = lbl.ALIGNMENT_LEFT
    lbl.Text = Text
    lbl.TextColor = Colors.White
    lbl.Font = Font.CreateNew(16)
    p.AddView(lbl, 5dip, 2dip, 250dip, Height - 4dip) 'view #0
End Sub

Thank you.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…