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

roMessageDialog & buffered button presses

I recently started using a roMessageDialog ontop of a roScreen and have noticed that the up & down & OK button presses are buffered and my app does stuff with them after the roMessageDialog is closed.

Is there a way to empty the button press buffer?

Other suggestions for dealing with this are welcome. ( I'm sure in another context this might be a feature! )

peace & 42
0 Kudos
3 Replies
Komag
Level 9

Re: roMessageDialog & buffered button presses

I don't know quite how it would work with a message dialog open, but I have called port.GetMessage() in a temporary while loop to constantly clear through anything coming in. For all I know it's a bad idea though, not an expert.
0 Kudos
belltown
Level 7

Re: roMessageDialog & buffered button presses

Roku does not recommend that 2D components and built-in BrightScript components co-exist. In situations like that I'll invalidate my roScreen AND its associated roMessagePort before showing the built-in component, then re-create them after closing the built-in component. Invalidating the roScreen's port ensures that none of the key press events that occurred while the built-in component was displayed will be received by the roScreen's port. If you do invalidate the roScreen at any point, make sure there is an underlying facade layer (e.g. an roImageCanvas), otherwise the channel will close when the roScreen is closed. This does mean, however, that you won't be able to get the roMessageDialog overlaid on top of the roScreen, although that's not really a supported feature anyway; if it works today, it may not work tomorrow. Another option is to build your own 2D message dialog using the same roScreen and roMessagePort, then you can do whatever you want with the screen display and key press events.
https://github.com/belltown/
0 Kudos
dev42
Level 7

Re: roMessageDialog & buffered button presses

TYVM to both of you!

peace & 42
0 Kudos