I would like to add a “Back” button to an instance of roPosterScreen.
However, I cannot seem to find a way to do it.
AddButton does not work for this object (it seems).
I mostly want this for people with the old Roku 1 remote controls which had no back button (and many don’t know that “up” equals back on these screens).
A visible on screen button in the lower right corner would be the perfect solution.
As you’ve discovered, you can’t add buttons to the poster screen. You’ll need to add a “Back” item to your content list if you want that kind of behavior, though I’d be surprised if there are any users with the Roku 1 remote that don’t know that “Up” closes the screen, as that’s standard across pretty much every channel.
Hmmm…my feeling was that if it were so obvious to Roku users that “UP” = “Back”, then Roku would not have included a separate Back button on the Roku 2 remote.
That is why I felt Roku 1 users probably needed a on screen Back button in case they did not know about the Up button’s functionality.
There’s Back, Up, and Home - all could conceivably cause the same thing to happen - to exit the channel. It’s anyone’s guess why they include redundant buttons to specifically cause confusion as to how their device works, but it’s the way they want it.
Dos anyone have the new remote with a dedicated netflix and hulu and crackle buttons? Do those exit the existing channel when pressed too?
No offense intended - but do we really need 6 buttons to press to exit a channel? It might give the impression that watching content isn’t what the box is about - it’s more about stopping content? Only OK works by default to select something - while you can make Play select something too with extra code.
“roquoonewbie” wrote:
Hmmm…my feeling was that if it were so obvious to Roku users that “UP” = “Back”, then Roku would not have included a separate Back button on the Roku 2 remote.
Owners of 1st generation Roku’s have never had a Back button (unless they bought a new remote), so the only way they know to close a screen is with the Up button. So one can assume that, they either know how it works, have bought a remote with a Back button, or have never been able to figure out how to get back to the grid screen from the springboard in Netflix…
“destruk” wrote:
There’s Back, Up, and Home - all could conceivably cause the same thing to happen - to exit the channel. It’s anyone’s guess why they include redundant buttons to specifically cause confusion as to how their device works, but it’s the way they want it.
Dos anyone have the new remote with a dedicated netflix and hulu and crackle buttons? Do those exit the existing channel when pressed too?
No offense intended - but do we really need 6 buttons to press to exit a channel? It might give the impression that watching content isn’t what the box is about - it’s more about stopping content? Only OK works by default to select something - while you can make Play select something too with extra code.
Back and Up will only exit the app if you’re on the last screen in the stack, otherwise they just close the current screen. The Back button didn’t exist on the first generation Roku’s. They added it when they released the second generation which is more logical for the end-user, but kept the Up functionality for legacy reasons. All of the buttons you mentioned have distinctly different behavior.
Up - Moves the focus up, closes the current screen on common SDK screens, if focus is on the top row.
Back - Closes the current screen, regardless of screen type or focused element.
Home - Exits the channel and returns to the home screen.
Netflix - Launches the Netflix channel, regardless of current location.
Pandora - Launches the Pandora channel, regardless of current location.
Crackle - Launches the Crackle channel, regardless of current location.
Now that the remotes are out there though, it’s rather difficult to have to account for the buttons that work in some places, like “info/*” and buttons that don’t work as intended on other screens - like up when you have “Behavior At Top Row” set to “stop” like Netflix does. Up and Back should exit Netflix to be consistent but they don’t. It simply adds to confusion about what buttons do what. – edit – Back exits Netflix on Roku2 - haven’t tried Roku1 lately for netflix.
What would ever cause the UI to get into a state where the “Up” button returned to the previous screen in the UI stack, but the “Back” button does nothing?
roImageCanvas requires most buttons (including the up and the back button) to be manually coded. There may be other screens that require it in the future.
“dbulli” wrote:
I am seeing the same thing where the back button doesn’t close the screen and no event is being fired. Up button does close the PosterScreen
Where are you seeing this? On a channel you wrote? Back works fine on a poster screen for me.
I can’t get up or back to work on my roPosterScreen. I want both (or at least either) of those buttons to be handled in my
else if msg.isScreenClosed() then
print "Screen closed"
return -1
endif
block, so my app can redraw the parent menu, but that code is never called. Back key exits the app completely and up key either navigates up from the content list to the filter banner, or from filter banner, up key will exit the app (without printing “Screen closed”). I even put a “stop” after the line “if type(msg) = “roPosterScreenEvent” then”, and the script does not break there, so “back” and “Up” are not making it into my event loop.
I’d really hate to have a content item called “Go back to previous menu”, so any help on how to handle buttons in roPosterScreen would be appreciated
I attached a sample app showing my problem handling a Back or Up key in my app. The app puts 3 category names in the filter banner, and 3 items in the content list. To reproduce the problem, just run the app, move down from the filter banner to the first content item, and select it. The app will reset the categories and list items with a new menu, and from there if you press Back or Up, it will simply exit the app rather than getting handled in the roPosterScreenEvent message handler. The expected behavior is that it should print “isScreenClosed”, return from the function, and redraw the parent menu.
'******************************************************************************
Function InitPosterScreen(screen As Object, level As String)
categoryArray = CreateObject("roArray", 5, true)
categoryArray[0] = "C1 " + level
categoryArray[1] = "C2 " + level
categoryArray[2] = "C3 " + level
screen.SetListNames(categoryArray)
screen.SetFocusedList(0)
itemsArray = CreateObject("roArray", 5, true)
item = CreateObject("roAssociativeArray")
item.ShortDescriptionLine1 = "Item1a" + level
item.ShortDescriptionLine2 = "Item1b" + level
itemsArray.Push(item)
item = CreateObject("roAssociativeArray")
item.ShortDescriptionLine1 = "Item2a" + level
item.ShortDescriptionLine2 = "Item2b" + level
itemsArray.Push(item)
item = CreateObject("roAssociativeArray")
item.ShortDescriptionLine1 = "Item3a" + level
item.ShortDescriptionLine2 = "Item3b" + level
itemsArray.Push(item)
screen.SetContentList(itemsArray)
screen.SetFocusedListItem(0)
End Function
'******************************************************************************
Function ShowMenu(screen As Object, level As String) As Integer
InitPosterScreen(screen, level)
screen.Show()
while true
msg = wait(0, screen.GetMessagePort())
if type(msg) = "roPosterScreenEvent" then
print "roPosterScreenEvent | msg = "; msg.GetMessage() " | index = "; msg.GetIndex()
if msg.isListFocused() then
print "Category focused | index = "; msg.GetIndex(); " | category = "; m.curCategory
else if msg.isButtonPressed() then
print "isButtonPressed" ; msg.GetIndex()
else if msg.isListItemSelected() then
print "isListItemSelected | index = "; msg.GetIndex()
' Show second level menu, Up or Back key should be handled in isScreenClosed() handler and return to caller.
print "Showing second level"
ShowMenu(screen, "- Level 2")
print "Done showing second level"
InitPosterScreen(screen, "- Level 1")
else if msg.isScreenClosed() then
print "isScreenClosed()"
return -1
end if
end If
end while
return 1
End Function
'******************************************************************************
Sub Main()
port = CreateObject("roMessagePort")
screen = CreateObject("roPosterScreen")
screen.SetMessagePort(port)
screen.SetListStyle("flat-category")
screen.setAdDisplayMode("scale-to-fit")
ShowMenu(screen, " - Level 1")
End Sub
You only have one roPosterScreen, so when it closes the channel exits. That’s normal behavior.
The way you’re using recursion and passing a single screen around is probably the root of the problem. For UP and BACK to work correctly, your UI should be a stack of multiple screens.