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.
Showing results for 
Show  only  | Search instead for 
Did you mean: 

knowing what triggered the observeField event Handler functions?

I am trying to create an event handler to listen to when a particular field changes on one of my screens. When the event handler is triggered, I would like to know which screen triggered the event handler to be called. In JavaScript, there is a concept of using the keyword "this" to know which item triggered the event.

For example:
buttons = $(".button");
buttons.on("click", onClick);
function onClick()

In the above example, I used "this" to know which of the buttons was clicked. Is there a way to do this when using the observeField() method? 
0 Kudos
Roku Guru

Re: knowing what triggered the observeField event Handler functions?

Check this out - not as direct as what you're describing but not as indirect as distinct callbacks for each calling screen.  hope it helps!

Optional roSGNodeEvent Callback Function Argument
Note that field observer callback functions can specify an roSGNodeEvent argument. For example, the changetext() callback function signature in the example above could have been written as sub changetext(event as roSGNodeEvent). In this case, the callback function can call the roSGNodeEvent functions to extract information about the node that triggered the callback, specific field that triggered the callback, etc.
0 Kudos