btpoole
9 years agoChannel Surfer
No Content Being Set
Using the SimpleMarkupList example in sdk but modifying it to get list and grid content from a task. Everything seems to be in order but I am not get anything to the screen. I noticed the example was using a for loop to populate the fields in the example. Is the loop just for demonstration purposes or do you actually have to loop thru the contentNode to set the content, if so how do you loop thru the contentnode fileds? When I execute the code below I get no errors in the scene graph or task ports. The task runs and from the print statement I put in the Task, the field for title is being populated. I do get the focus box where the text would be and do get the generic grid icons that were setup with the grid part of the code. I have left out the grid part as I am just trying to get the list to populate first.
Edit: If I edit the line in getMarkupListData()that sets each field from [size=85]dataItem.posterUrl = m.simpleMarkupList.hdposterurl to [size=85]dataItem.posterUrl = m.simpleMarkupList.content.hdposterurl[/font][/size][/font][/size]
I get a syntax error for each line that sets a field value.
SimpleMarkupScene.brs
ContentReader.xml
Edit: If I edit the line in getMarkupListData()that sets each field from [size=85]dataItem.posterUrl = m.simpleMarkupList.hdposterurl to [size=85]dataItem.posterUrl = m.simpleMarkupList.content.hdposterurl[/font][/size][/font][/size]
I get a syntax error for each line that sets a field value.
SimpleMarkupScene.brs
function init()
?"IN init"
m.simpleMarkupList = m.top.findNode("SimpleMarkupList")
m.simpleMarkupGrid = m.top.findNode("SimpleMarkupGrid")
m.ContentTask = createObject("RoSGNode","InitialContentReader")
m.simpleMarkupList.content=setlist()
m.ContentTask.control = "RUN"
m.simpleMarkupList.SetFocus(true)
m.simpleMarkupList.ObserveField("itemFocused", "onFocusChanged")
Function setList()
?"IN SETLIST"
m.data = CreateObject("roSGNode", "ContentNode")
m.simpleMarkupList.content =m.ContentTask.channelcontent
data=getMarkupListData()
return data
end function
function getMarkupListData() as object
?"IN GETMARKUPLISTDATA"
dataItem = m.data.CreateChild("SimpleListItemData")
dataItem.posterUrl = m.simpleMarkupList.content.hdposterurl
dataItem.labelText = m.simpleMarkupList.content.title
dataItem.label2Text = m.simpleMarkupList.content.title
return m.data
end function
ContentReader.xml
<?xml version="1.0" encoding="utf-8" ?>
<!--********** Copyright 2016 Roku Corp. All Rights Reserved. **********-->
<component name = "InitialContentReader" extends = "Task" >
<interface>
<field id = "channelcontent" type = "node" />
</interface>
<script type = "text/brightscript" >
<![CDATA[
sub init()
m.top.functionName = "readcontent"
end sub
sub readcontent()
PRINT "IN TASK"
channelcontent= createObject ("RoSGNode", "ContentNode")
'//////////////////CHANNEL LIST CONTENT///////////////////////////
url="http://192.168.1.xx:xxxx/data/list.php"
readInternet = createObject("roUrlTransfer")
readInternet.setUrl(url)
jsoncontent = ParseJson(readInternet.GetToString())
for each items in jsoncontent.items
contentitem =channelcontent.createChild("ContentNode")
contentitem.hdposterurl=items.icon
contentitem.title=items.name
?contentitem.title '//THIS IS SHOWING CONTENT
end for
m.top.channelcontent= channelcontent
?"OUT OF TASK"
end sub
]]>
</script>
</component>