Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
 
End Sub
 
Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
Dim aScroll As ScrollView
Dim scrollPanel As Panel
Type labelsXYpos(xpos As Int,ypos As Int)
End Sub
 
Sub Activity_Create(FirstTime As Boolean)
 
Dim actHeight As Int, actWidth As Int
Dim curcol As Int,currow As Int
Dim cols As Int ,rows As Int
Dim selCol As Int, seltext As String
Dim colWidth As Int, rowHeight As Int
Dim newcolor As Int
Dim rnNumber As Int
 
Activity.LoadLayout ("1")
actHeight=Activity.Height
actWidth=Activity.Width
aScroll.Initialize (Activity.Height)
scrollPanel=aScroll.Panel
Activity.AddView (aScroll,0,0,actWidth,actHeight)
 
cols=2:rows=10
colWidth=actWidth/cols
rowHeight=actHeight/rows
selCol=1
seltext="test"
newcolor=Colors.Red
 
For currow=0 To rows-1
 
For curcol=0 To cols-1
 
Dim txt As String
Dim l As Label
Dim xy As labelsXYpos
 
txt=currow & "," & curcol
 
If curcol=selCol Then
rnNumber=Rnd(0,2)
If rnNumber=0 Then txt=seltext
End If
 
l.Initialize ("label")
l.Text =txt
l.Gravity =Gravity.CENTER
xy.Initialize
xy.xpos =curcol
xy.ypos =currow
l.Tag =xy
scrollPanel.AddView (l,curcol*colWidth,currow*rowHeight,colWidth,rowHeight)
 
If curcol=selCol AND txt=seltext Then
Dim l2 As Label
l2=scrollPanel.GetView (currow*cols)
l2.TextColor =newcolor
End If
 
Next
 
Next
 
End Sub
 
Sub Activity_Resume
 
End Sub
 
Sub Activity_Pause (UserClosed As Boolean)
 
End Sub
 
 
Sub label_click
Dim l As Label
Dim xy As labelsXYpos
l=Sender
xy=l.Tag
ToastMessageShow("Label at X=" & xy.xpos & ", Y=" & xy.ypos & " =" & l.Text,False)
End Sub