Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
tmann
Visitor

Setting focus on Sliding Panels

I'm converting some old legacy channels to RSG.  I want to emulate the Roku player screen design by having a base labellist that feeds various types of panels on the right.  My first attempt is to create the postergrid and have focus pass to it.  

I have it partially working, it displays and you can right arrow to the grid and scroll around the grid.  Then you can left arrow back to the original labellist but things go awry at that point.  

After left arrowing back to the original labellist, if you try to right arrow over to the grid a second time, it slides and shows the grid on the left but the grid never gets focus. 

What am I missing or doing wrong?


Here is my code:

<component name = "MainMenu" extends = "OverhangPanelSetScene" >

<script type = "text/brightscript" >

    sub init()
m.top.id = "MainMenu"
m.top.backgroundURI = "pkg:/images/background.png"
m.top.overhang.color = "0x081874FF"
m.top.overhang.showOptions = true
m.top.overhang.optionsColor = "0x081874FF"
m.top.overhang.optionsAvailable = false
m.top.overhang.logoUri = "pkg:/images/overhang_logo.png"

devInfo = createObject("roDeviceInfo")
m.UIResolution = devInfo.getUIResolution()
m.scenesize = m.top.sceneBoundingRect()

m.MainMenuList = m.top.panelSet.createChild("MainMenuList")
m.MainMenuItem = m.top.panelSet.createChild("BrowseMoviesGrid")
m.MainMenuList.list.observeField("itemFocused", "ShowMenuItem")
m.MainMenuItem.observeField("focusedChild","SlideMenuItem")

m.MainMenuList.setFocus(true)

end sub


sub ShowMenuItem()

MenuItemContent = m.MainMenuList.list.content.getChild(m.MainMenuList.list.itemFocused)
m.MenuItemBox = createObject("RoSGNode","MenuItemBox")

end sub


sub SlideMenuItem()

if not m.top.panelSet.isGoingBack
  m.top.panelSet.appendChild(m.MenuItemBox)
  m.MainMenuItem.setFocus(true)
else
  m.MainMenuList.setFocus(true)
end if 

end sub
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.