Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
'Déclaration des boutons et labels
Dim btn(12) As ToggleButton 'boutons des quilles
Dim bdwOn, bdwOff As BitmapDrawable 'images des boutons quilles
Dim ln, rw As Int
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("loTour")
'Initialisation des boutons quilles
Dim i As Int
For i = 0 To 11
Dim sld As StateListDrawable 'Définir les différents états des boutons quilles
sld.Initialize
btn(i).Initialize("Quille")
btn(i).Tag = i
bdwOn.Initialize(LoadBitmap(File.DirAssets, "Quille_" & (i+1) & "_Croix.png"))
bdwOff.Initialize(LoadBitmap(File.DirAssets, "Quille_" & (i+1) & ".png"))
sld.AddState(sld.State_Checked, bdwOn)
sld.AddState(sld.State_Unchecked, bdwOff)
btn(i).Background=sld
'Initialiser le bouton sans texte dessus et par défaut en position off
btn(i).TextOff = ""
btn(i).TextOn = ""
btn(i).Checked = False
BlEtatBouton = btn(i).Checked
'Ajouter le bouton à la vue, ' rangées de 3 boutons
If (i mod 3) = 0 Then
ln = 1
rw = rw + 1
Else
ln = ln + 1
End If
Activity.AddView(btn(i), (ln * 22%x), (rw * 70Dip), 15%x, 60Dip)
Next
End Sub