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

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 1
joetesta
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!
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
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.