Hi
i try to click on the buttons inside the scrollview, each one will open a new activity according to variable i, i use a code posted in the forum by claus and try to modify it but i don't can't find a way to use if condition clicking button inside scrollview to open each time a new page ! any help please.
i try to click on the buttons inside the scrollview, each one will open a new activity according to variable i, i use a code posted in the forum by claus and try to modify it but i don't can't find a way to use if condition clicking button inside scrollview to open each time a new page ! any help please.
B4X:
Sub Globals
Dim ScrollView1 As ScrollView
Dim lstChecks As List
Dim height As Int
height = 50dip
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Activity.LoadLayout("Layout1")
ScrollView1.Initialize(0)
Dim pnl As Panel
pnl = ScrollView1.Panel
Activity.AddView(ScrollView1, 10%x, 10%y, 20%x, 60%y)
lstChecks.Initialize
For i = 1 To 50
Dim btn As Button
btn.Initialize("")
btn.Text = i
lstChecks.Add(btn)
pnl.AddView(btn, 0, height * (i - 1), 40dip, height)
'pnl.AddView(lbl1, 125dip, height * (i - 1), 120dip, height)
Next
pnl.Height = lstChecks.Size * height
Activity.AddMenuItem("Display clicked", "btnClicked")
End Sub
Sub btnClicked_Click
Dim sb As StringBuilder
sb.Initialize
For i = 0 To lstChecks.Size - 1
Dim btn As Button
btn = lstChecks.Get(i)
Case i
StartActivity("Page1")
If btn(i) Is clicked Then
StartActivity("Page1")
End If
Next
End Sub