Sub init()
m.ContentTask_program = createObject("RoSGNode","ContentReader_Program")
m.ContentTask_program.ObserveField("ProgramContent", "setupcontent")
m.ContentTask_program.control = "RUN"
m.ProgramMarkupGrid.ObserveField("itemFocused", "onFocusChanged")
end sub
sub setupcontent()
m.programdata=m.ContentTask_program.ProgramContent.temp
updatecontent()
end sub
sub updatecontent()
m.ProgramMarkupGrid.content=setGridContent()
m.ProgramMarkupGrid.visible=true
m.ProgramMarkupGrid.SetFocus(true)
end sub
function onFocusChanged() as void
if m.ProgramMarkupGrid.visible=true
m.columnFocused=m.ProgramMarkupGrid.itemFocused MOD m.ProgramMarkupGrid.numColumns
?"PROGRAM COLUMN FOCUSED "m.columnFocused
end if
end function
just use unobserveField().
see this article :
https://developer.roku.com/en-gb/docs/developer-program/core-concepts/handling-application-events.md