Entry:onChange() event
This event is fired when the user has modified the Entry content.
Return value
The event returns no value.Example
local ui = require "ui"
-- create a simple Window
local win = ui.Window("Entry:onChange() sample", 320, 200)
local label = ui.Label(win, "Enter a number : ", 60, 80)
local entry = ui.Entry(win, "", label.x+label.width+10, label.y-4)
function entry: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