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: 
btpoole
Channel Surfer

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 1
btpoole
Channel Surfer

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
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.