I've been having an issue changing focus from a RowList component to the HomeScene object that the RowList component is indirectly a part of. An abbreviated version of the component hierarchy:
<component name="HomeScene" extends="Scene"... <children> <Rectangle> <Channels Grid />
<component name="ChannelsGrid" extends="RowList"...
m.top.setFocus(true)
function onKeyEvent(key as String, press as Boolean) as Boolean handled = false if press then if m.top.hasFocus() if key = "left" OR key = "right" <do_stuff> else if key = "down" m.channelsGrid.setFocus(true) handled = true end if else if m.channelsGrid.hasFocus() if key = "back" m.channelsGrid.setFocus(false) 'Line that solved the problem m.top.setFocus(true) handled = true end if end if end if
return handled
end function
This never transferred focus back to the HomeScene. I would even test the focus value in back to back lines:
? m.top.setFocus(true) ? m.top.hasFocus()
And it would print out:
true false
I then manually set focus to false for the HomeScene and it started to work as desired:
m.channelsGrid.setFocus(false) m.top.setFocus(true)
But I read in the docs that you should never do this. I don't want to just take the win and move forward because there's something that I don't understand about how focus works. Some clarification would be greatly appreciated.
Hi. Were you able to figure this out ? What OS version was the device ?
Anyone figured this out yet?
We’re upgrading Roku Community to bring you a faster, more mobile-friendly experience. You may notice limited functionality or read-only access during this time. You will not be able to log in or post new comments or kudos during this time. Read more here.
Planned Downtime:
Community will be unavailable for up to 24–48 hours during the upgrade window during the week of May 12 and you may notice reduced functionality.
In the meantime, for additional assistance, visit our Support Site.
Thanks for your patience — we’re excited to share what’s next!