components_config_LoginScene.bs
import "pkg:/source/roku_modules/log/LogMixin.brs"
import "pkg:/source/utils/misc.bs"
sub init()
m.log = log.Logger("LoginScene")
m.top.setFocus(true)
m.top.optionsAvailable = false
m.list = m.top.findNode("configOptions")
m.checkbox = m.top.findNode("onOff")
m.buttons = m.top.findNode("buttons")
end sub
' JRScreen hook.
sub OnScreenShown()
' Clear backdrop on login screens
m.global.sceneManager.callFunc("setBackgroundImage", "")
scene = m.top.getScene()
overhang = scene.findNode("overhang")
if isValid(overhang)
overhang.isLogoVisible = true
overhang.currentUser = ""
end if
end sub
function onKeyEvent(key as string, press as boolean) as boolean
if not press then return false
if key = "back"
m.top.backPressed = true
else if key = "down" and not isValid(m.checkbox.focusedChild) and not isValid(m.buttons.focusedChild)
limit = m.list.content.getChildren(-1, 0).count() - 1
if limit = m.list.itemFocused
m.checkbox.setFocus(true)
return true
end if
else if key = "down" and not isValid(m.buttons.focusedChild)
m.buttons.setFocus(true)
return true
else if key = "up" and isValid(m.buttons.focusedChild)
m.checkbox.setFocus(true)
return true
else if key = "up" and isValid(m.checkbox.focusedChild)
m.list.setFocus(true)
return true
end if
return false
end function
' destroy: Full teardown releasing all resources before component removal
' Called automatically by SceneManager.popScene() / clearScenes()
sub destroy()
m.log.verbose("destroy")
' Clear node references
m.list = invalid
m.checkbox = invalid
m.buttons = invalid
end sub