guy i've this error and i don't know why
on this line
percento is a function that i made
how can i create an array of button from designer?
if i have to create array from code (as the code above) of can i do events onclick of a button(4) for example?
on this line
here the codepnlcontenitore.AddView(quadrato(i), 0+percento(3, False), 0+percento(3, False), latoquadrato, latoquadrato)
B4X:
'Activity module
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 pnlContenitore As Panel
Dim quadrato(0 To 9) As Button
Dim altezza, larghezza As Long
Dim latoQuadrato As Double
Dim nQuadrati As Int
Dim Button As Button
nQuadrati=8
End Sub
Sub Activity_Create(FirstTime As Boolean)
Dim layout As LayoutValues
Dim i As Int
activity.LoadLayout("general")
altezza=layout.Height
larghezza=layout.Width
pnlcontenitore.Height=larghezza
pnlcontenitore.Width=larghezza
pnlcontenitore.Top=(altezza/2)-(pnlcontenitore.Height/2)
latoquadrato=(larghezza/3)-percento(12, False)
For i=0 To nquadrati
Select Case i
Case 0, 3, 6
pnlcontenitore.AddView(quadrato(i), 0+percento(3, False), 0+percento(3, False), latoquadrato, latoquadrato)
Case 1, 2, 4, 5, 7, 8
pnlcontenitore.AddView(quadrato(i), quadrato(i-1).Left, quadrato(i-3).width+percento(3, False), latoquadrato, latoquadrato)
End Select
Next
End Sub
percento is a function that i made
how can i create an array of button from designer?
if i have to create array from code (as the code above) of can i do events onclick of a button(4) for example?
Last edited: