What I am saying is that for every one click of the remote to move the focus, it executes 2x. For example focus starts on column 0 of grid. I press right button on remote, In debugger window the print statement appears 2x. Below is min code. Task runs in int, calls the setupcontnet, updatecontent from there. The setGridContent (not shown) loops thru and sets field values for grid. I set focus at end of updatecontent. Below code is result of debugger.
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
DEBUGGER:
PROGRAM COLUMN FOCUSED 0
PROGRAM COLUMN FOCUSED 0
PROGRAM COLUMN FOCUSED 1
PROGRAM COLUMN FOCUSED 1
PROGRAM COLUMN FOCUSED 2
PROGRAM COLUMN FOCUSED 2
PROGRAM COLUMN FOCUSED 3
PROGRAM COLUMN FOCUSED 3
Grid starts on column 0, click right remote button moves to 1, then 2 then 3. Prints multiple times.