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: 
destruk
Binge Watcher

SetUpBehaviorAtTopRow("exit") Problem

I create a gridscreen, and populate it with content. When a user selects a video, it then creates the detail screen on top of the gridscreen - and selecting play it plays the video. That works really well.
When the video finishes playing the videoscreen (on top) closes, which returns the user to the detail screen for the selection. That is fine too.
When the user presses Up on the remote, it closes the detail screen and returns them to the exact place they were in the gridscreen - which is perfectly fine as well.
The issue I'm seeing is, from the detail screen, if the user keeps the up button held down too long, it closes the detail screen as well as the gridscreen with two beeps.
People with twitchy remote fingers from too much caffeine will not experience this problem...lol

I can work around it by toggling the value - ie when an item is selected, change it to "stop", and when an item is focused, change it back to exit again. What this means is when closing the detail screen, the user needs to focus a different item on the gridscreen before enabling an 'exit' condition for the top row. Or I could create an item somewhere to manually close the window - but that wouldn't be very intuitive depending on what the grid placement was when the previous screen was closed.
Also, if it is set to "stop" and you hold the up button down on the top row you just get hundreds of repeated beeps - when there probably shouldn't be any beeps, or a single beep would suffice.

Perhaps the easiest solution would be for the component to clear the button status when returning from a different screen?
0 Kudos
7 REPLIES 7
TheEndless
Channel Surfer

Re: SetUpBehaviorAtTopRow("exit") Problem

I've noticed this and reported a similar issue before. When exiting a screen on top of the grid screen, you'll often get a double-up of the key press event. This is most noticeable on a roMessageDialog with more than two buttons. If you show an roMessageDialog with three or more buttons on top of a grid screen, trying to select one of the middle buttons is an exercise in patience, as most button presses get registered twice, so the button selection jumps twice. I've worked around it by displaying a tiny (1 pixel x 1 pixel) transparent roImageCanvas in front of the grid screen prior to showing any screens on top of it. When doing that, only single key press events are received. If the roImageCanvas is running in the same context as the dialog/screen you're showing on top of the grid screen, it will automatically go out of scope and close with the screen. It's a little convoluted, but it may be a workable solution until Roku addresses the bug...

Here's a simple example of what I'm talking about:

' Show tiny canvas to eat extra key press events
canvas = CreateObject("roImageCanvas")
canvas.SetLayer(0, { Color: "#00000000", TargetRect: { x: 0, y: 0, w: 1, h: 1 } })
canvas.Show()
' Wait 250ms to give the canvas time to show... probably not necessary
Sleep(250)

messageBox = CreateObject("roMessageDialog")
messageBox.SetMessagePort(CreateObject("roMessagePort"))
messageBox.SetTitle("My Dialog Title")
messageBox.AddButton(1, "Button 1")
messageBox.AddButton(2, "Button 2")
messageBox.AddButton(3, "Button 3")
messageBox.AddButton(4, "Button 4")

messageBox.Show()
While true
msg = wait(0, messageBox.GetMessagePort())
If msg <> invalid Then
If Type(msg) = "roMessageDialogEvent" Then
If msg.IsButtonPressed() Then
If canvas <> invalid Then
' The canvas should close itself, but just to be safe...
canvas.Close()
End If
Return msg.GetIndex()
End If
End If
End If
End While
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
destruk
Binge Watcher

Re: SetUpBehaviorAtTopRow("exit") Problem

Thankyou again TheEndless.
0 Kudos
destruk
Binge Watcher

Re: SetUpBehaviorAtTopRow("exit") Problem

The doubleup keypress behavior appears to be fixed in 3.0 without the image canvas requirement. Still, if a user holds down the UP button on the remote from any screen on top of a gridscreen, the gridscreen has autorepeat behavior for the up button, so it'll exit if set to exit as soon as the up button is polled. 😞
0 Kudos
TheEndless
Channel Surfer

Re: SetUpBehaviorAtTopRow("exit") Problem

"destruk" wrote:
The doubleup keypress behavior appears to be fixed in 3.0 without the image canvas requirement. Still, if a user holds down the UP button on the remote from any screen on top of a gridscreen, the gridscreen has autorepeat behavior for the up button, so it'll exit if set to exit as soon as the up button is polled. 😞

Unless it was fixed in the most recent update, I don't think it's fixed, as I've experienced it very recently (within the past 3 or 4 weeks), and all of my dev boxes are running 3.0 (but I'm too lazy to test it right now :P).
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
destruk
Binge Watcher

Re: SetUpBehaviorAtTopRow("exit") Problem

No problem - maybe I typed it in wrong or something. It didn't seem to cause problems having the code in there. I do appreciate the idea and code to look at.
0 Kudos
TheEndless
Channel Surfer

Re: SetUpBehaviorAtTopRow("exit") Problem

"destruk" wrote:
No problem - maybe I typed it in wrong or something. It didn't seem to cause problems having the code in there. I do appreciate the idea and code to look at.

Just to clarify, my code was meant to prevent it from happening, not reproduce it. If you comment out the first few lines that create and show the canvas, you should see the issue if it's still present.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
destruk
Binge Watcher

Re: SetUpBehaviorAtTopRow("exit") Problem

I was trying to reproduce the issue by removing your code fix. I couldn't so that must be corrected now. 🙂 Leaving the code fix in doesn't seem to cause a problem either.
0 Kudos