Hi All
A question about somethimg which I thought should not be a problem.
In the following code I try to specify the labels Height/Width/Left/Top all of which cause a crash. I can't see the issue.
The line "FNumLabel(i).Height = 5.625%y" is the first to throw an error.
I am sure it is something simple but I usually do all this in the designer.
Thanks in advance
Roger
A question about somethimg which I thought should not be a problem.
In the following code I try to specify the labels Height/Width/Left/Top all of which cause a crash. I can't see the issue.
The line "FNumLabel(i).Height = 5.625%y" is the first to throw an error.
I am sure it is something simple but I usually do all this in the designer.
B4X:
Sub Globals
Dim FNumLabel(16) As Label
End Sub
Sub FNumSelect
'Brings up ListView to allow selection of F0-F15 as assigned function.
'Called by Formula_click
ListFlag = 1
FNumView.SingleLineLayout.ItemHeight = 5.625%y
FNumView.Color = Colors.DarkGray 'ListView color matches Label color
FNumView.Clear
For i = 0 To 15
For Each v As View In Activity.GetAllViewsRecursive
If v Is Label Then
If v.Tag = "F"&i Then
FNumLabel(i).Initialize("FNumLabel"&i)
FNumLabel(i).TextColor = lbl.TextColor
FNumLabel(i).Text = lbl.Text
FNumLabel(i).Height = 5.625%y
FNumLabel(i).Width = 100%x
FNumLabel(i).Color = Colors.Transparent
FNumLabel(i).Left = 0
FNumLabel(i).Top = 10%y + (i*5.625%y)
End If
End If
Next
FNumView.AddSingleLine("")
Next
Activity.AddView(FNumView, 0, 10%y, 100%x, 90%y) 'Displays the list built by the previous loop.
lblTitle.Text = "Select a Function Key to Program"
lblTitle.TextSize = 14*FontScale
lblTitle.BringToFront
lblTitle.Height = 10%y
ListBack.BringToFront
ListBack.Height = 10%y
FNumView.BringToFront
End Sub

Thanks in advance
Roger