Sub Activity_Create (FirstTime As Boolean)
'globals:
'Dim Buttons(18) As Button
'Dim materials(15) as string
'materials(0)="Concrete"
'materials(1)="Sand"
'materials(2)="Asphalt"
' ...
Activity.LoadLayout("18buttons.bal")
Buttons = Array As Button (Button01,Button02,Button03,Button04,Button05,Button06,Button07,Button08,Button09,Button10,Button11,Button12,Button13,Button14,Button15,Button16,Button17,Button18)
Dim i,t,l As Int
t=10
l=10
If Activity.Height>Activity.Width Then
'portrait
Panel1.Top = 45
Panel1.Left = 10
Panel1.Width = 480
Panel1.Height = 955
For i = 0 To 17
Buttons(i).Top = t
Buttons(i).Left = l
Buttons(i).Width = 150
Buttons(i).Height = 150
Buttons(i).Text = materials(i)
l=l+155
If ((i+1) Mod 3) = 0 Then
t=t+155
l=10
End If
Next
Else
'landscape
Panel1.Top = 100
Panel1.Left = 35
Panel1.Width = 955
Panel1.Height = 480
For i = 0 To 17
Buttons(i).Top = t
Buttons(i).Left = l
Buttons(i).Width = 150
Buttons(i).Height = 150
Buttons(i).Text = materials(i)
l=l+155
If ((i+1) Mod 6) = 0 Then
t=t+155
l=10
End If
Next
End If
Button17.Visible = False
Button18.Visible = False
end sub