Files
slate32/sdcard/.lua/apps/Keyboard/main.lua
T
evan 61c2f9a6fb refactor(ui): adopt tree-owned scrolling and the ui.* module namespace
Scroll and optionlist drop their own drag/flick controllers now that
ui.lua owns them; main forwards deltaMs to ui.draw. keyboard, optionlist
and statusbar move under ui.* -- keyboard into the shared submodule,
optionlist/statusbar to sdcard/.lua/lib/ui. Bumps esp32-lua-api.
2026-08-06 17:08:07 -04:00

39 lines
728 B
Lua

local ui = require "ui"
local keyboard = require "ui.keyboard"
---@class KeyboardApp : SlateApp
local M = {}
local valueLabel
local shown = "type something"
local function show(prefix, value)
shown = value == "" and "type something" or prefix .. value
ui.setText(valueLabel, shown)
end
function M.init()
log.info "keyboard test ready"
end
function M.node()
valueLabel = ui.text(shown, { w = "fill" })
return ui.box {
w = "fill",
h = "fill",
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,
},
}
end
return M