Your Digital Media Has Never Looked So Good

Topic Author
Posts: 19
Joined: Fri Mar 10, 2017 5:00 pm

Centralized onKeyEvent or managing several

Mon Apr 17, 2017 10:52 am

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?
User avatar
Posts: 465
Joined: Fri Mar 31, 2017 2:22 pm

Re: Centralized onKeyEvent or managing several

Tue Apr 18, 2017 4:09 pm

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.

Who is online

Users browsing this forum: No registered users and 4 guests