natiny.view.get_focus

Lua
natiny.view.get_focus() -> view

Returns the view that currently holds the program-wide input focus.

Returns

Type Description
number Focused view handle, or 0 when no view has focus

Example

Lua
if natiny.view.get_focus() == 0 then
    natiny.view.set_focus(first_field)
end