[Gambas-user] how to place code into events of an array of buttons?
Gianluigi
bagonergi at gmail.com
Tue Feb 1 17:26:25 CET 2022
Il giorno mar 1 feb 2022 alle ore 16:57 <roberto.premoli at tiscali.it> ha
scritto:
> 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()...
>
>
> 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
>
Change Form_Open like this
' ...
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
With btns[n] = New Button(FMain) As "btns"
.Name = matrice_testo[n]
End With
Next
' ...
Public Sub btns_Click()
Print Last.name
End
Regards
Gianluigi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20220201/d9bf4ed5/attachment.htm>
More information about the User
mailing list