Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Private Button1 As Button
Private Button2 As Button
Private Button3 As Button
Private Button4 As Button
Private Button5 As Button
Private Button6 As Button
Private Button7 As Button
Private Button8 As Button
Private Button9 As Button
Private Button10 As Button
Private Button11 As Button
Private Button12 As Button
Private Button13 As Button
Private Button14 As Button
Private Button15 As Button
Private Button16 As Button
Private Button17 As Button
Private Button18 As Button
Private Button19 As Button
Private Button20 As Button
Private allbtn As Map
Private Label1 As Label
Private Label2 As Label
Private Label3 As Label
Private Label4 As Label
Private Label5 As Label
Private Panel5 As Panel
Private Panel4 As Panel
Private Panel3 As Panel
Private Panel2 As Panel
Private Panel1 As Panel
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("Layout40")
allbtn.Initialize
allbtn.Put("btn"&1,Button1)
allbtn.Put("btn"&2,Button2)
allbtn.Put("btn"&3,Button3)
allbtn.Put("btn"&4,Button4)
allbtn.Put("btn"&5,Button5)
allbtn.Put("btn"&6,Button6)
allbtn.Put("btn"&7,Button7)
allbtn.Put("btn"&8,Button8)
allbtn.Put("btn"&9,Button9)
allbtn.Put("btn"&10,Button10)
allbtn.Put("btn"&11,Button11)
allbtn.Put("btn"&12,Button12)
allbtn.Put("btn"&13,Button13)
allbtn.Put("btn"&14,Button14)
allbtn.Put("btn"&15,Button15)
allbtn.Put("btn"&16,Button16)
allbtn.Put("btn"&17,Button17)
allbtn.Put("btn"&18,Button18)
allbtn.Put("btn"&19,Button19)
allbtn.Put("btn"&20,Button20)
allbtn.Put("lbl"&1,Label1)
allbtn.Put("lbl"&2,Label2)
allbtn.Put("lbl"&3,Label3)
allbtn.Put("lbl"&4,Label4)
allbtn.Put("lbl"&5,Label5)
allbtn.Put("pnl"&1,Panel1)
allbtn.Put("pnl"&2,Panel2)
allbtn.Put("pnl"&3,Panel3)
allbtn.Put("pnl"&4,Panel4)
allbtn.Put("pnl"&5,Panel5)
End Sub
Sub Button_Click
For Each key As String In allbtn.Keys
Dim v As View = allbtn.Get(key)
If v Is Label Then
Dim lbl As Label = v
lbl.Color = Colors.ARGB(Rnd(100, 150),Rnd(20, 800),Rnd(80, 160),Rnd(161, 255))
else if v Is Panel Then
Dim pnl As Panel = v
pnl.Color = Colors.ARGB(Rnd(100, 150),Rnd(20, 800),Rnd(80, 160),Rnd(161, 255))
else if v Is Button Then
Dim btn As Button = v
btn.Color = Colors.ARGB(Rnd(100, 150),Rnd(20, 800),Rnd(80, 160),Rnd(161, 255))
End If
Next
End Sub