Combobox:onChange() event


This event is fired when the user has modified the Combobox text.

Return value

The event returns no value.

Example

local ui = require "ui" -- create a simple Window local win = ui.Window("Combobox:onChange() sample", 320, 200) local label = ui.Label(win, "Enter a number : ", 60, 80) local combobox = ui.Combobox(win, {"10", "33", "77", "LuaRT"}, label.x+label.width+10, label.y-4) function combobox:onChange() if #self.text > 0 and tonumber(self.text) == nil then self.text = self.text:gsub("%D", "") end end win:status("Enter only numeric characters") win:show() -- update user interface repeat ui.update() until not win.visible