lcd.hasFocus¶
since 1.5.0
Return true if the current window has the focus, else false.
Parameters¶
None.
Returns¶
focus (boolean)
Examples¶
local function paint(widget)
local w, h = lcd.getWindowSize()
if lcd.hasFocus() then
lcd.color(lcd.themeColor(THEME_FOCUS_COLOR))
lcd.drawRectangle(0, 0, w, h, 2) -- show the pilot this widget takes input
end
end
On the home screen a widget only receives key events while it has focus. See Events.
Real-world usage¶
Called 15 times across 5 open-source Ethos Lua projects. A few short excerpts: