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

Centralized onKeyEvent or managing several

Hi Forum,

I was wondering about best practices...If I have several .brs that work as Screens, meaning each have a specific purpose and are called from a main scene, but I was wondering if it is better to have an onKeyEvent each screen or manage all the key events (centralized with many many validations) onthe main scene. I find it more tidy to have several onKeyEvents, but I've noticed that the onKeyevent on the main scene is always fired regardless if I have another in a secondary screen (brs).

What do you suggest?
0 Kudos
1 REPLY 1
RokuNB
Roku Guru

Re: Centralized onKeyEvent or managing several

Your issue is likely not returning `true` at the end of the first handler:
"onKeyEvent()" wrote:
The onKeyEvent() function must return true if the XML component handled the event, or false if it did not handle the event. Returning false allows the event to continue bubbling up the focus chain so that ancestors of the XML component can handle the event.
0 Kudos