Forum Discussion
Interesting! The getparent().getparent() thing works in grid item node. I've learned something at least.
I always feel like there's some tricky extra-threads stuff going on in the background with those, so it's possible things are happening in a different order to what we might expect.
What happens if you add some logging just before .jumptoitem ? Do "ShowContent" logs happen before, after, or a mix?
An alternative thing you can try, as your 'watched' list is in the same place as your content, is adding a .watched boolean field to your content nodes, and setting it to true for the relevant ones before reassigning .content=lessonsContent. Then your nodes are your single source of data for the grid, which I think is closer to how Roku intends these to work.
(Extend ContentNode, or use addField+setField)
In the end I managed to fin a way to do it. I used the itemHasFocus field:
<component name = "MarkupGridItem" extends = "Group" >
<interface>
<field id = "itemContent" type = "node" onChange = "showcontent"/>
<field id = "itemHasFocus" type = "float" onChange = "showfocus"/>
</interface>
sub showfocus(event as Object)
if event.getData() = 1
watchedArray = m.top.getParent().getParent().watched
if contains(watchedArray, m.number)
m.watched.visible = true
m.watched.uri = "https://path/check_sequence.png"
end if
end if
end sub
Works in my case because these are very short videos that don't move automatically from one video to the next, so the selected video is the one that has the focus upon returning from the video screen. The updating of the watched list happens before this runs.