[Gambas-user] how to place code into events of an array of buttons?
roberto.premoli at tiscali.it
roberto.premoli at tiscali.it
Tue Feb 1 16:56:36 CET 2022
Usually i create object one by one using graphila placemen of
object,
but now i need a lot of buttons, label, ecc in my aplication,
so
i create them "in code" to have an array of them.
here ad example with
only 5 buttons:
Private btns[5] As Button
Private matrice_testo[5] As
String
Public Sub Form_Open()
Dim larghezza As Integer
Dim altezza As
Integer
Dim larghezza_tasto As Integer
Dim altezza_tasto As Integer
Dim
n, m As Integer
Dim offset_verticale As Integer
larghezza =
fmain.Width
altezza = fmain.height
larghezza_tasto = larghezza /
10
altezza_tasto = altezza / 12
offset_verticale = altezza / 2
For n =
0 To 4
btns[n] = New Button(FMain) As "btns"
Next
matrice_testo[0] =
"A"
matrice_testo[1] = "B"
matrice_testo[2] = "C"
matrice_testo[3] =
"D"
matrice_testo[4] = "E"
For n = 0 To 4 'prima riga'
btns[n].text =
matrice_testo[n]
btns[n].Left = larghezza_tasto * n
btns[n].Top =
offset_verticale
btns[n].Height = 50
btns[n].width = larghezza_tasto
btns[n].Show
Next
end
the code place the buttons as I want but now i
don't know how to place code inside the "click", doubleclick", "got
focus" ecc and other events of the buttons. Can someone tell me how?
many thanks.
Roberto
Con Tiscali Mobile Smart 70 hai 70 GB in 4G, minuti illimitati e 100 SMS a soli 7,99€ al mese http://tisca.li/Smart70
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20220201/ef075fc1/attachment.htm>
More information about the User
mailing list