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)