<component name="TopMenu" extends="Group" initialFocus="foo1">
<children>
<LayoutGroup>
<Button id="foo1" text="Hello" />
<Button id="foo2" text="World" />
</LayoutGroup>
</children>
</component>
topMenu.setFocus(true)
topMenu.getChild(0).setFocus(true)
topMenu.getChild(0).getChild(0).setFocus(true)
Thank you so much i was stuck on this!
Oh, hilarious.. I saw this thread in the list and thought somebody had nicked my name. But it's my old account, from back when I didn't know anything!
So, I eventually progressed beyond the custom focus setter but I'm not sure the current approach is cleaner. As you can see, nobody contributed a good answer. 🙂
I ended up with a pretty messy solution involving observing 'focusedChild', and making use of .isInFocusChain(). I seem to recall you get a 'focusedChild' event in a component when you .setFocus() it, and then you can do a setFocus on the child component you want to actually be selected.
I'm afraid I abstracted it all away into code I no longer totally understand, but you at least have two avenues to investigate now.
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!