Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
btpoole
Channel Surfer

Advance RowList Example SDK

Looking thru and taking apart the advanced rowlist example in the sdk and have run into something. In the example the label list is being assigned values from a static list.  Each value is passed to the sub addRowListTestItem as a string. Well, according the doc the labellist will probably be populated from a feed from a server. If a task is created to get info from server, the content is returned to the code, how can the content then passed to the sub to set the values of labelist title? I don't think it can as a string since it's not a string but a  contentnode. Is there a way like with an array where you can step thru each value passing the title field value to the sub with a contentnode? If the m.list.content is set to the task.content, the label is populated basically eliminating the need to pass the value to the sub, correct? Have I overlooked something in the process?
From sdk
function init()
    print "in rowListExamplesListPanel init"
    m.list = m.top.FindNode("examplesList")
    m.top.list = m.list
    m.rowListTestListContent = createObject("RoSGNode", "ContentNode")
    addRowListTestItem("Simple Test", "SimpleRowListPanel")
    addRowListTestItem("Mixed Aspect Test", "MixedAspectRowListPanel")
    addRowListTestItem("Markup On Focus Test", "MarkupOnFocusRowListPanel")
    m.list.content = m.rowListTestListContent
    ' set up the PanelSet title to be "RowList Examples"
    ' when this panel is on the left
    m.top.overhangTitle = "RowList Examples"
    m.top.id           = "GridExamplesListPanel"
    m.top.panelSize    = "narrow"
    m.top.hasNextPanel = true
    ' observe focusedChild to that the LabelList can
    ' take the key event focus when the PanelSet gives
    ' the focus to this Panel
    m.top.observeField("focusedChild", "focusChanged")
    m.top.observeField("createNextPanelIndex", "createRowListExamplePanel")
end function

sub addRowListTestItem(label as string, component as string)
print "in addRowListTestItem"
   testListItemNode = createObject("RoSGNode", "RowListExampleContentNode")

   ' setting title will set the RowListExampleContentNode's ContentMetaData field
   testListItemNode.title = label

   ' setting componentName will set the RowListExampleContentNode's componentName
   ' interface field
   testListItemNode.componentName = component

   m.rowListTestListContent.appendChild(testListItemNode)
end sub
0 Kudos
1 REPLY 1
btpoole
Channel Surfer

Re: Advance RowList Example SDK

SOLVED  thanks to https://forums.roku.com/viewtopic.php?f=34&t=96813&p=541090&hilit=contentnode#p541090.
0 Kudos