task_gridcontent.xml
<?xml version="1.0" encoding="utf-8" ?>
<!--********** Copyright 2016 Roku Corp. All Rights Reserved. **********-->
<component name = "resetgrid" extends = "Task" >
<interface>
<field id = "ProgramContent" type = "node" />
</interface>
<script type="text/brightscript" uri="pkg:/source/main.brs" />
<script type="text/brightscript" uri="pkg:/components/home/setupcontent.brs" />
<script type="text/brightscript" uri="pkg:/components/home/content.brs" />
<script type="text/brightscript" uri="pkg:/components/timeutility/timeutility.brs" />
<script type="text/brightscript" uri="pkg:/components/setup_variable.brs" />
<script type = "text/brightscript" >
<![CDATA[
sub init()
PRINT "IN resetgrid TASK"
m.currentTime=getCurrentTime() 'CURRENT TIME IN SECONDS
upDateGrid()
end sub
function upDateGrid()
i=0
?"in UpDateGrid"
m.showcontent=createobject("roSGNode", "ContentNode")
for each items in m.roProgramlist.items
for each show in items.show
if show.start >= m.currentTime and m.currentTime <= show.end
i=i+1
?i
dataitem=m.showcontent.Createchild("ContentNode")
dataitem.addfields({"title" : show.title})
dataitem.addfields({"desc" : show.dec})
else
end if
end for
end for
m.top.ProgramContent=m.showcontent
end function
]]>
</script>
</component>
sub resetgrid()
m.spinner.control="start"
m.spinner.visible=true[/font][/size]
m.updateGrid = createObject("RoSGNode","resetgrid")
m.updateGrid.ObserveField("state", "resetcontent")
m.updateGrid.control = "RUN"
end sub
function resetcontent()
if m.updateGrid.state = "stop"
setcolumnWidth()
m.programmarkupgrid.content= m.updateGrid.ProgramContent
m.spinner.control= "stop"
m.spinner.visible=false
m.spinnerlabel.visible=false
m.ProgramMarkupGrid.visible=true
m.programmarkupgrid.SetFocus(true)
else
end if
end function
"btpoole" wrote:task_gridcontent.xml
<?xml version="1.0" encoding="utf-8" ?>
<!--********** Copyright 2016 Roku Corp. All Rights Reserved. **********-->
<component name = "resetgrid" extends = "Task" >
<interface>
<field id = "ProgramContent" type = "node" />
</interface>
<script type="text/brightscript" uri="pkg:/source/main.brs" />
<script type="text/brightscript" uri="pkg:/components/home/setupcontent.brs" />
<script type="text/brightscript" uri="pkg:/components/home/content.brs" />
<script type="text/brightscript" uri="pkg:/components/timeutility/timeutility.brs" />
<script type="text/brightscript" uri="pkg:/components/setup_variable.brs" />
<script type = "text/brightscript" >
<![CDATA[
sub init()
PRINT "IN resetgrid TASK"
m.currentTime=getCurrentTime() 'CURRENT TIME IN SECONDS
upDateGrid()
end sub
function upDateGrid()
i=0
?"in UpDateGrid"
m.showcontent=createobject("roSGNode", "ContentNode")
for each items in m.roProgramlist.items
for each show in items.show
if show.start >= m.currentTime and m.currentTime <= show.end
i=i+1
?i
dataitem=m.showcontent.Createchild("ContentNode")
dataitem.addfields({"title" : show.title})
dataitem.addfields({"desc" : show.dec})
else
end if
end for
end for
m.top.ProgramContent=m.showcontent
end function
]]>
</script>
</component>
Function that calls tasksub resetgrid()
m.spinner.control="start"
m.spinner.visible=true[/font][/size]
m.updateGrid = createObject("RoSGNode","resetgrid")
m.updateGrid.ObserveField("state", "resetcontent")
m.updateGrid.control = "RUN"
end sub
function resetcontent()
if m.updateGrid.state = "stop"
setcolumnWidth()
m.programmarkupgrid.content= m.updateGrid.ProgramContent
m.spinner.control= "stop"
m.spinner.visible=false
m.spinnerlabel.visible=false
m.ProgramMarkupGrid.visible=true
m.programmarkupgrid.SetFocus(true)
else
end if
end function
Here is the task, the calling function and the callback. The debugger shows the execution error occurs in the task, but not always on the same line of the task.
"destruk" wrote:
So you're saying when you try to "addfields" a field name that already exists, like Title, times out the task, but when you simply assign a value to an existing field it doesn't?
"btpoole" wrote:"destruk" wrote:
So you're saying when you try to "addfields" a field name that already exists, like Title, times out the task, but when you simply assign a value to an existing field it doesn't?
Yes, that's seems to be the case. I had been using addfields previously but the error started. After many hours of changing things around I hit upon just setting the field and the error stopped and code produced expected response. I ran into this in other areas as well.
sub resetgrid()
[size=100]m.updateGrid = createObject("RoSGNode","updatecontent")[/size]
m.updateGrid.ObserveField("state", "resetcontent")
m.updateGrid.control = "RUN"
[size=100]end sub[/size]
<?xml version="1.0" encoding="utf-8" ?>
<!--********** Copyright 2016 Roku Corp. All Rights Reserved. **********-->
<component name = "updatecontent" extends = "Task" >
<interface>
[size=100]<field id = "FileContent" type = "node" />[/size]
[size=100] </interface>[/size]
[size=100] <script type="text/brightscript">[/size]
<![CDATA[
sub init()
PRINT "IN updatecontent TASK"
contentTransfer()
end sub
function contentTransfer()
url="http:/xxxxx.xx.xxx:xxxx/contentfile.php"
rocurl = createObject("roUrlTransfer")
roport=CreateObject("roMessagePort")
rocurl.setUrl(url)
m.top.FileContent=[size=85][font=monospace]rocurl.GetToString()[/font][/size]
[size=100]]]>[/size]
</script>
</component>
"destruk" wrote:
You might need to drop the Roku2 - Roku3s and Roku4s don't behave this way.