Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 
btpoole
Level 7

Help In Getting Correct Selection on roGrid

I've never worked with screens or grid before on a channel, previous development has been on roImageCanvas.  I have got the grid to load all of my data into categories correctly.  The problem comes when I select a particular video to play. For some reason it only picks selections from Row 0. If I scroll across Row 0 and pick a video, it is correct, but if I move to say Row2 it still pricks the correct col but only from Row 0. I got the example code from the roku sdk online. Any help appreciated.
Thanks

m.port=CreateObject("roMessagePort")
screen = CreateObject("roGridScreen")
screen.SetMessagePort(m.port)
screen.SetDisplayMode("scale-to-fill")
shows=m.showlist

categoryList = getCategoryList()

screen.setupLists(categoryList.count())
screen.SetListNames(categoryList)
Print"NUMBER IN CATEGORYLIST. . ."categoryList.count()


for i = 0 to categoryList.count()-1
screen.SetContentList(i,getShowsForCategoryItem(categoryList,shows))
end for
screen.Show()  
    
  while true
         msg = wait(0, m.port)
         if type(msg) = "roGridScreenEvent" then
             if msg.isScreenClosed() then
                 return -1
             elseif msg.isListItemFocused()
                 print "Focused msg: ";msg.GetMessage();"row: ";msg.GetIndex();
                 print " col: ";msg.GetData()
             elseif msg.isListItemSelected()
                 print "Selected msg: ";msg.GetMessage();"row: ";msg.GetIndex();
                 print " col: ";msg.GetData()
                 Print"CHANNEL NAME . . . . "m.showList[msg.GetData()].title
                 playcontent(m.showList[msg.GetData()].stream)
             endif
         endif
     end while
0 Kudos
1 Reply
btpoole
Level 7

Re: Help In Getting Correct Selection on roGrid

Please ignore the question, I had left out a line or so from the example. All working now.
0 Kudos