Arezth
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2017
10:52 AM
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?
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?
1 REPLY 1
NB_
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2017
04:09 PM
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.