Sub Activity_Create(FirstTime As Boolean)
Private col, row As Int
For row = 0 To 2
For col = 0 To 2
Private btn As Button
btn.Initialize("")
btn.Text = "Test"
Select row
Case 0
Select col
Case 0
btn.Gravity = Bit.Or(Gravity.TOP, Gravity.LEFT)
Case 1
btn.Gravity = Bit.Or(Gravity.TOP, Gravity.CENTER_HORIZONTAL)
Case 2
btn.Gravity = Bit.Or(Gravity.TOP, Gravity.RIGHT)
End Select
Case 1
Select col
Case 0
btn.Gravity = Bit.Or(Gravity.CENTER_VERTICAL, Gravity.LEFT)
Case 1
btn.Gravity = Bit.Or(Gravity.CENTER_VERTICAL, Gravity.CENTER_HORIZONTAL)
Case 2
btn.Gravity = Bit.Or(Gravity.CENTER_VERTICAL, Gravity.RIGHT)
End Select
Case 2
Select col
Case 0
btn.Gravity = Bit.Or(Gravity.BOTTOM, Gravity.LEFT)
Case 1
btn.Gravity = Bit.Or(Gravity.BOTTOM, Gravity.CENTER_HORIZONTAL)
Case 2
btn.Gravity = Bit.Or(Gravity.BOTTOM, Gravity.RIGHT)
End Select
End Select
Activity.AddView(btn, 10dip + col * 110dip, 20dip + row * 80dip, 100dip, 60dip)
Next
Next
End Sub