iOS Question Fit to width on resize for CreateListItem


Active Member
Licensed User
Longtime User
How do I get the labels to fit the width of the screen when I rotate the device? I'm adding labels/lines to a customlistview with this code:

clv2.Add(CreateListItem(Line, clv2.AsView.Width, 50dip), 50dip, "")

And the CreateListItem code looks like:

Sub CreateListItem(Text As String, Width As Int, Height As Int) As Panel
    Dim p As Panel
    p.Color = Colors.White
    Dim lbl As Label
    lbl.TextAlignment = lbl.ALIGNMENT_LEFT
    lbl.Text = Text
    lbl.Font = Font.CreateNew(16)
    'Add label to panel
    p.AddView(lbl, 5dip, 2dip, 100%x, Height - 4dip) 'view #0
    Return p
End Sub

I'm not sure what else to put in the resize sub because the lines go all the way across the width on rotate, but lines that have lots of text do not resize to take advantage of more width:

Private Sub PageHistory_Resize(Width As Int, Height As Int) 'History Page
    clv2.SetSize(100%x, 100%y)
End Sub