Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 
btpoole
Level 7

rowList Problems

Using the RowListExample from the sdk but having problems getting anything on the screen. The example uses an xml file for it's content, but my content is coming from a server call thru a task urltransfer. I know my task is working and the content node is populated.  Really not sure what to set the rowlist.content to. Since the task has run in order to create content, I put the rowlist info in a sub to run once the task had executed. The screen comes up and the date and time label displays (I am not showing that below in code but it's there) but nothing else.  Any suggestions?
Initial Scene:
<component name = "BEATA ROW_SG" extends = "Scene" initialFocus ="EXList" >

  <script type="text/brightscript" >

    <![CDATA[

sub init()
'////////////CREATE TASK TO LOAD DATA/////////////////////////////
    m.readVideoContentTask = createObject("RoSGNode","InitialContentReader")  
    m.readvideoContentTask.observeField("channelcontent", "setup")
    m.readVideoContentTask.control = "RUN"
end sub

sub setup()
  rowlist = m.top.findNode("ExList")
  rowlist.content =CreateObject("roSGNode","NOT SURE WHAT TO PUT HERE")  'THIS IS WHERE EXAMPLE CALLS XML FILE FOR CONTENT

end sub

    ]]>

  </script>

  <children>
    <RowList
   id = "ExList"
   translation = "[5,5 ]"
   itemComponentName = "ExListItem"
   numRows = "4"
   itemSize = "[ 1608, 308 ]"
   rowItemSize = "[ [100, 100] ]"
   itemSpacing = "[ 0,5 ]"
   showRowLabel = "[ true ]"
   drawFocusFeedback = "false"
   vertFocusAnimationStyle = "fixedFocusWrap"
   rowFocusAnimationStyle = "fixedFocusWrap" />


   
  </children>

</component>



ExListItem
<?xml version = "1.0" encoding = "utf-8" ?>

<!--********** Copyright 2016 Roku Corp.  All Rights Reserved. **********-->

<component name = "ExListItem" extends = "Group" >

  <interface >
    <field id = "itemContent" type = "node" onChange = "showcontent"/>
    <field id = "focusPercent" type = "float" onChange = "showfocus"/>
    <field id = "rowFocusPercent" type = "float" onChange = "showrowfocus"/>
  </interface>

  <script type = "text/brightscript" >

    <![CDATA[

    sub init()
      m.itemposter = m.top.findNode("itemPoster")
      m.itemmask = m.top.findNode("itemMask")
      m.itemlabel = m.top.findNode("itemLabel")
    end sub

    sub showcontent()
      itemcontent= m.top.channelcontent   '//m.top.channelcontent created in task
      m.itemposter.uri = m.itemcontent.content.HDPosterUrl
      m.itemlabel.text = itemcontent.title
    end sub

    sub showfocus()
      scale = 1 + (m.top.focusPercent * 0.08)
      m.itemposter.scale = [scale, scale]
    end sub

    sub showrowfocus()
      m.itemmask.opacity = 0.75 - (m.top.rowFocusPercent * 0.75)
      m.itemlabel.opacity = m.top.rowFocusPercent
    end sub

    ]]>

  </script>

  <children >

    <Poster
      id = "itemPoster"
      translation = "[ 10, 10 ]"
      width = "512"
      height = "288"
      scaleRotateCenter = "[ 256.0, 144.0 ]" >

      <Rectangle
        id = "itemMask"
        color = "0x000000FF"
        opacity = "0.75"
        width = "512"
        height = "288"
        scaleRotateCenter = "[ 256.0, 144.0 ]"/>

    </Poster>

    <Label
      id = "itemLabel"
      translation = "[ 20, 264 ]"
      horizAlign = "right"
      width = "492"
      opacity = "0.0"/>

  </children>

</component>

0 Kudos
2 Replies
joetesta
Level 10

Re: rowList Problems

With this line: m.readvideoContentTask.observeField("channelcontent", "setup")

Your 'setup' function will have access to m.readvideoContentTask.channelcontent

Assuming your InitialContentReader task is building a proper ContentNode (with a list of ContentNode children), you should just be able to assign
rowlist.content = m.readvideoContentTask.channelcontent
aspiring
0 Kudos
btpoole
Level 7

Re: rowList Problems

Thanks for the direction. Actually after looking thru multiple examples late in the night, was able to put it together but thank you for the help.
0 Kudos