Your Digital Media Has Never Looked So Good

 
lock_4815162342
Topic Author
Posts: 63
Joined: Tue Dec 31, 2013 11:47 am

Set focus of grid (SimpleGridWithDetailsAndVideo)

Tue Sep 12, 2017 12:16 pm

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.  :)
 
joetesta
Posts: 592
Joined: Wed Apr 20, 2011 11:48 am

Re: Set focus of grid (SimpleGridWithDetailsAndVideo)

Sat Sep 16, 2017 8:21 am

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
grid2.jumpToItem(currentItemFocus)
aspiring

Who is online

Users browsing this forum: No registered users and 6 guests