Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 
jaxim
Level 7

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()
{
$(this).text()
}



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
1 Reply
joetesta
Level 10

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!
Joe

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.
aspiring
0 Kudos