Files
slate32/sdcard/apps/Keyboard/main.lua
T

26 lines
688 B
Lua

local ui = require("ui")
local keyboard = require("keyboard")
local screen, valueLabel
local function show(prefix, value)
valueLabel:setText(value == "" and "type something" or prefix .. value)
end
function init()
valueLabel = ui.text("type something", {w = "fill"})
screen = ui.screen(ui.box{pad = 8, gap = 5,
valueLabel,
keyboard.new{
max_length = 40,
on_change = function(value) show("value: ", value) end,
on_submit = function(value) show("submitted: ", value) end,
},
})
log.info("keyboard test ready")
end
function draw() screen:draw() end
function on_touch_down(x, y) screen:down(x, y) end
function on_touch_up(x, y) screen:up(x, y) end