local combobox_T={}
local ui = require "ui"
local win = ui.Window("Win", 500, 300)
local comboboxMain = ui.Combobox(win,{"1", "2", "3", "4", "5", "6" } , 20, 20)
win:show()
function comboboxMain:onSelect()
for i=1, #combobox_T do
combobox_T={nil}
end
local combobox_T={}
local y= 0
for i=1, tonumber(comboboxMain.text) do
y= y + 25
combobox_T[i] = ui.Combobox(win,{"1", "2", "3"}, 140, y)
end
end
repeat
ui.update()
until not win.visible
I have a problem with the above codes.
For example, in the combobox I created with the name comboboxMain, I chose the value 5, then I create these 5 new comboboxes (I put them in the table so I don't encounter string name problems combobox_T={} ). now my goal is this! When I choose a new value from the comboboxMain again (for example 3), I want the new comboboxes that I defined before to be deleted and re-created according to the 3 values I specified. that is, delete all comboboxes except somboboxMain and create these comboboxes again according to the value I have just set.