[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 18:50:51 CET 2022
> 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
Thanks Gianluigi!
there is a way to take also the index of button pressed?
because to have the index of button is necessary in other part of the
program,
I tried - naively - to do "variabile = Last.index" bot of course it
does not work.
If it is not possible, i can populate ".tag = n" and read it but it
will appear
to me more "clean" to use ".index" or similar, if available.
Roberto
PS: i miss so much to have "indexed objects" in Gambas graphical
interface as it
is available in VB.
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
More information about the User
mailing list