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

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 3
Komag
Roku Guru

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
Roku Guru

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.
0 Kudos
dev42
Visitor

Re: roMessageDialog & buffered button presses

TYVM to both of you!

peace & 42
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.