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: 
wtglover
Visitor

Custom Panels not correctly transferring focus to children

Hi there.

Trying to build a Scene Graph application that uses panels. I want to create a panel that displays a RowList, but I'm having trouble getting the RowList to scroll. I have the PanelSet as a child node to my Scene, and in BrightScript from the Scene I call


m.contentPanel = CreateObject("roSGNode", "ContentPanel")
m.panelSet.appendChild(m.contentPanel)
m.contentPanel.setFocus(true)


Then, in ContentPanel, I have a child called ContentGrid that extends from RowList.


m.top.panelSize = "full"
m.top.hasNextPanel = false
m.top.isFullScreen = true

m.contentGrid = m.top.createChild("ContentGrid")
m.contentGrid.setFocus(true)


The focus indicator is drawn around the first item in my ContentGrid, but the arrow keys do not allow for movement through the RowList. Any suggestions or even hunches as to why this would be the case would be greatly appreciated!

EDIT:
This is starting to feel like a bug to me. If I let the roku go into 'sleep' mode (aka screensaver is shown) and then wake it up, I am then able to scroll through the RowList perfectly fine.
0 Kudos
2 REPLIES 2

Re: Custom Panels not correctly transferring focus to childr

I'm having the exact same problem. I thought I was the only one seeing this. For me, putting the RowList directly in the Scene works great, however, when I put the RowList as a child of a non-scene component, I get the focus on the first item in the RowList, but I'm unable to scroll. Returning from the roku screen saver gets it working again (as you explained)
0 Kudos
mrstevie
Visitor

Re: Custom Panels not correctly transferring focus to childr

I don't know if this will help or if we have a similar use case but I had the same problem but managed to fix it doing the following.

If you set the focus on the RowList component before it has any rows (i.e. you will dynamically add rows to the RowList after the Init() function), you will need to set the focus again.

I fixed mine by observing the focused state and setting the focus again on the RowList.

Something like this:


Sub Init()
m.contentPanel = m.top.FindNode("ContentPanel") ' I previously declare it in the XML component with some basic properties.
' .... some dynamic properties.
m.contentPanel.SetFocus(True)
m.contentPanel.ObserveField("rowItemFocused", "onContentPanelFocused")
End Sub

Sub onContentPanelFocused()
m.contentPanel.SetFocus(True)
End Sub


Hope this helps.
0 Kudos