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.
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Channel Surfer

Set focus of grid (SimpleGridWithDetailsAndVideo)

How do you set the focus on a grid?  :?:

I am trying to learn ScreenGraph and I am using the SimpleGridWithDetailsAndVideo sample project. I have modified the app to display a second grid screen when selecting an item from the first grid screen. I want to be able to load the second grid screen with the correct item selected but the index is always [0,0].

I have tried setting the field "itemFocused" for the second grid. This causes the description, title and background image to display at the top of the screen for the item that I set. However, the first item is always focused (blue highlight box around it) despite setting the itemFocused. 

I also tried setting rowItemSelected but this triggers the selection listener and causes all kinds of issues. Besides I just want to focus the item not select it.  :roll:

Where do I set the index of where I want the focus to be on the grid? Am I misunderstanding something?  :?:

Thank you very much for taking the time to read this. Any information that you can offer will be very appreciated.  🙂
0 Kudos
Roku Guru

Re: Set focus of grid (SimpleGridWithDetailsAndVideo)

itemFocused is Read only which means you won't be able to set it.
I think what you want to do is to use "jumpToItem" Assuming the 2nd grid focus should be on the same item as the current first grid focus, it would be something like:

currentItemFocus = grid1.itemFocused
0 Kudos