I have a Problem with a scrollview and I have downloaded every example that I found but I don't understand how to fill every panel with the information i want.
ATM I use this peace of code that's fine I see my Panel that i created in the designer on top of the SV.
But Know I want to add some text on a label that is placed onto the Panel!
And I don't know how to do this.
I have tried to declare my label live
DIM lb_name as Label (lb_name is the label name on my Panel in the Designer)
That I have initialized that and added a Text, but this is now shown.
B4X:
Sub Globals
Dim sv As ScrollView
End Sub
Sub Activity_Create(FirstTime As Boolean)
sv.Initialize(13%x * 10)
Activity.AddView(sv, 0, 0, 100%x, 100%y)
For i = 0 To 10
Dim p As Panel
Dim tn1 As Label 'Name of the Lable in matchpanel.bal
p.Initialize("")
tn1.Initialize("")
p.LoadLayout("matchpanel")
tn1.Text = "ALPHA" 'This Part now is not working WHY??????????
sv.Panel.AddView(p, 0,i * 13%x, sv.Panel.Width, 13%x)
Next
End Sub
Please give me an advice how to fill my labels.
Thanks
I will attach my Project to provide you all my work on this.
It appears from the code you are attempting to create an array of panels and labels in wich case they need to be indexed like so:
B4X:
Dim p(11) As Panel
Dim tn1(11) As Label
For i = 0 To 10
p(i).Initialize("")
tn1(i).Initialize("")
p(i).LoadLayout("matchpanel")
tn1(i).Text = "ALPHA"
sv.Panel.AddView(p(i), 0,i * 13%x, sv.Panel.Width, 13%x)
Next
Later it will run over an sqlite database and add every match-up that is written in the database. so to make a try I used the For/Next i have now checked your code and it seems that the Label doesn't get the text ALPHA inside!