Entry.textlimit read/write property
Get or set a number value, indicating the maximum length of the text entered.
Setting the property with a value of 0, permits a maximum of 64000 characters.
Example
local ui = require "ui"
-- create a simple Window
local win = ui.Window("Entry.textlimit sample", 320, 200)
local entry = ui.Entry(win, "0", 135, 60, 70)
entry.textlimit = 2
win:status("Enter a number between 0 and 99")
entry.font = "Times New Roman"
entry.fontsize = 24
win:show()
function entry:onSelect()
if tonumber(entry.text) ~= nil then
ui.msg("You have entered number "..entry.text)
else
ui.error(entry.text.." is not a valid number")
end
end
-- update the user interface until the user closes the Window
repeat
ui.update()
until not win.visible