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: 
salman23
Level 7

Navigation Controls problem

I have a problem.During navigation from one page to another and coming back to the previous page,the controls(for eg:buttons) in the page is not working.I even can't navigate to the next poster screen.What i did was that i combined the posterscreen template with gridscreen template.When i click an item in the gridscreen ,it will redirect to posterscreen.But it is not working.Help please?
Grid.brs
Function showGridScreen(screen As Object, gridstyle as string) As string
poster=CreateObject("roPosterScreen")
port = CreateObject("roMessagePort")
poster.SetMessagePort(port)
poster.SetListStyle("arced-landscape")
print "enter showGridScreen"
categoryList = getgridCategoryList()
categoryList[0] = "GridStyle: " + gridstyle
screen.setupLists(categoryList.count())
screen.SetListNames(categoryList)
StyleButtons = getGridControlButtons()
screen.SetContentList(0, StyleButtons)
for i = 1 to categoryList.count()-1
screen.SetContentList(i, getgridShowsForCategoryItem(categoryList[i]))
end for
screen.Show()

while true
print "Waiting for message"
msg = wait(0, screen.GetMessagePort())
if type(msg) = "roGridScreenEvent" then
if msg.isListItemFocused() then
print"list item focused | current show = "; msg.GetIndex()
else if msg.isListItemSelected() then
row = msg.GetIndex()
selection = msg.getData()
print "list item selected row= "; row; " selection= "; selection
value = showPosterScreen(poster)
else if msg.isScreenClosed() then
return ""
end if
end If
end while


End Function


Poster.brs

Function showPosterScreen(screen As Object) As Integer

categoryList = getCategoryList()
screen.SetListNames(categoryList)
screen.SetContentList(getShowsForCategoryItem(categoryList[0]))
screen.Show()

while true
msg = wait(0, screen.GetMessagePort())
if type(msg) = "roPosterScreenEvent" then
print "showPosterScreen | msg = "; msg.GetMessage() " | index = "; msg.GetIndex()
if msg.isListFocused() then
'get the list of shows for the currently selected item
screen.SetContentList(getShowsForCategoryItem(categoryList[msg.GetIndex()]))
print "list focused | current category = "; msg.GetIndex()
else if msg.isListItemFocused() then
print"list item focused | current show = "; msg.GetIndex()
else if msg.isListItemSelected() then
print "list item selected | current show = "; msg.GetIndex()
VideoPlayer()
'if you had a list of shows, the index of the current item
'is probably the right show, so you'd do something like this
'm.curShow = displayShowDetailScreen(showList[msg.GetIndex()])
else if msg.isScreenClosed() then
return -1
end if
end If
end while


End Function
0 Kudos