[Gambas-user] how to destroy and array of ojects?

roberto.premoli at tiscali.it roberto.premoli at tiscali.it
Fri Dec 15 23:27:26 CET 2023


  

hello, i have a panel, i create an array of button inside as
follow.

Private mbl_button As New Button[40]

row = 4
col = 10
quantity
= 39

For b As Integer = 0 To quantity
 With mbl_button[b] = New
Button(tastiera_panel) As "tastiera_array"
 mbl_button[b].x = (b % col)
* (tastiera_pannello.Width / col)
 mbl_button[b].w =
tastiera_panel.width / col
 mbl_button[b].h = tastiera_panel.Height /
row
 mbl_button[b].y = Int(b / col) * mbl_button[b].h

mbl_button[b].name = b
 mbl_button[b].Border = 1
 mbl_button[b].text =
b
 End With
Next

it create a matrix 4x10 of buttons, it works ok.

now
my need: along the program, I need to recreate another matrix (let say
2x5), so is enough to
chage parameters (row = 2, col = 5, quantity = 19)
and recall the code. But if i do,
i create new buttons over the existing
buttons: what i need is fist destroy the existing 4x10 buttons and
then
create on same place my new matryx 2x5.

i need something as

For b As
Integer = 0 To quantity
 destroy(mbl_button[b])
Next

how can I do
it?
thanks

  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20231215/6588eadc/attachment-0001.htm>


More information about the User mailing list