Combobox.items
Provides access to the list of the Combobox items.
Example
--! luart-extensions
import ui
-- create a simple Window
local win = ui.Window("Combobox.items sample", 306, 80)
local label = ui.Label(win, "Enter an item index : ", 10, 30)
local entry = ui.Entry(win, "1", label.x+label.width+6, label.y-4, 22, 22)
local combobox = ui.Combobox(win, { "LuaRT", "is", "fun"}, entry.x+entry.width+6, label.y-4)
-- disable the combobox
combobox.enabled = false
-- Event fired when user press RETURN in the Entry field
function entry:onSelect()
local item = combobox.items[entry.text] or false
if item then
combobox.selected = item
else
ui.error(entry.text.." is not a valid index")
end
end
entry:onSelect()
win:show()
-- update user interface
repeat
ui.update()
until not win.visible