Sub Process_Globals
Dim Timer(10) As Timer
End Sub
Sub Globals
Dim Panel1(10) As Panel
Dim pp(10) As Int 'ScrollView Positions
Dim vv(10) As String'selected value
Dim L1 As Label
Dim sv(10) As ScrollView
Dim fi As String
Dim Label1 As Label
Dim Label2 As Label
Dim Label3 As Label
Dim Label4 As Label
Dim Label5 As Label
Dim Label6 As Label
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("main")
For ii = 0 To 2
Timer(ii).Initialize("TimerX", 700+ii) ' 1000 = 1 second
sv(ii).Initialize2(666,"ScrollViewX")
sv(ii).Tag=ii
Activity.AddView(sv(ii),30dip+(70dip*ii),70dip,70dip,100dip)
Select ii
Case 0
SetupScrollViews(ii,24)
Case 1
SetupScrollViews(ii,59)
Case 2
SetupScrollViews(ii,59)
End Select
Next
Label1.BringToFront
Label2.BringToFront
For ii = 3 To 5
Timer(ii).Initialize("TimerX", 700+ii) ' 1000 = 1 second
sv(ii).Initialize2(666,"ScrollViewX")
sv(ii).Tag=ii
Activity.AddView(sv(ii),30dip+(70dip*(ii-3)),230dip,70dip,100dip)
Select ii
Case 3
SetupScrollViews(ii,24)
Case 4
SetupScrollViews(ii,59)
Case 5
SetupScrollViews(ii,59)
End Select
Next
Label4.BringToFront
Label5.BringToFront
DoEvents
For ii = 0 To 5
pp(ii)=Rnd(0,12)*55
sv(ii).ScrollPosition=Round(pp(ii)/55)*55+5
Next
End Sub
Sub SetupScrollViews(ii As Int, z As Int)
Panel1(ii)= sv(ii).Panel
For i = 0 To z
Dim Label1 As Label
Label1.Initialize("")
Label1.Color=Colors.LightGray
Label1.textColor=Colors.Black
Label1.TextSize=24
Label1.Gravity=Gravity.CENTER
Label1.Text=NumberFormat( i,2,0)
Panel1(ii).AddView(Label1,3,(i+1)*55,96,58)
Next
Panel1(ii).Height=55*i+111
Panel1(ii).Color = Colors.DarkGray
End Sub
Sub ScrollViewX_ScrollChanged(Position As Int)
Dim index As Int
Dim SV1 As ScrollView
SV1=Sender
index=SV1.Tag
pp(index)=Position
Timer(index).Enabled = True
End Sub
Sub TimerX_Tick
Dim index As Int
Dim ti As Timer
ti=Sender
index=ti.Interval-700 'sorry ;-)) the timer has no tag
sv(index).ScrollPosition=Round(pp(index)/55)*55+5
Timer(index).Enabled = False
vv(index)=Round(pp(index)/55)
vv(index)="0"&vv(index)
vv(index)=vv(index).SubString(vv(index).Length-2)
Activity.Title=vv(0)&":"&vv(1)&":"&vv(2)
End Sub