self:set_focussed

Client

Requests OS focus for the webview, and additionally takes over as the global input forwarder when eligible


Syntax

local status = self:set_focussed(
    state
)

Parameters

TypeNameDescription
boolstateDetermines the webview's focus state:
• When true - requests OS focus for the webview (if visible), and additionally becomes the global input forwarder if forward_input option was enabled
• When false - releases OS focus; if the webview was the global input forwarder, another eligible visible webview is automatically selected to take over

Returns

TypeNameDescription
boolstatustrue on successful execution, false otherwise

Examples

Focus a webview and let it take over input forwarding
local hud = core.webview.create({ 
    forward_input = true
})

local phone = core.webview.create({ 
    forward_input = false
    
})

hud:set_visible(true)
phone:set_visible(true)

-- HUD becomes both OS-focused and the global input forwarder
hud:set_focussed(true)

-- Phone can still receive OS focus for its own UI,
-- but will never become the global input forwarder
phone:set_focussed(true)

On this page