Combobox:remove(index | item) method


Remove an item from the Combobox.

index | item

A number representing an item index, or a ComboItem representing the item to be removed.

Return value

This function returns no value.

Example

local ui = require "ui" -- create a simple Window local win = ui.Window("Combobox:remove() sample", "fixed", 360, 80) local label = ui.Label(win, "Select item :", 80, 30) local combobox = ui.Combobox(win, {"LuaRT", "is", "fun !"}, label.x+label.width+6, label.y-4) local removebtn = ui.Button(win, "X", combobox.x+combobox.width+6, label.y-4, 22, 22) removebtn.enabled = false function removebtn:onClick() -- removes current selected item combobox:remove(combobox.selected) combobox.text = "" end function combobox:onChange() removebtn.enabled = #self.text > 0 end win:show() -- update user interface repeat ui.update() until not win.visible