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: 
slavique
Visitor

MarkupList does not create last element on OS 8.0

Hi

I've got the problem with markupList after OS 8.0 rolled out. Last item is not created until focus moved on that item.
I have reproduced this bug on example from sdk - https://sdkdocs.roku.com/download/attachments/1607190/SimpleMarkupList.zip?version=1&modificationDate=1479517444958&api=v2 after slight modification.
This is how list gets configured:
SimpleMarkupListScene.brs
function init()
   m.simpleMarkupList = m.top.findNode("SimpleMarkupList")
   m.simpleMarkupList.content = getMarkupListData()
   m.simpleMarkupGrid = m.top.findNode("SimpleMarkupGrid")
   m.simpleMarkupGrid.content = getMarkupGridData()
   m.simpleMarkupList.SetFocus(true)
   m.simpleMarkupList.ObserveField("itemFocused", "onFocusChanged")
   m.rowHeights = []
   m.itemIndex = 0
   m.global.addFields({scene: m})
 
end function

function getMarkupListData() as object
   ? "getMarkupListData !!!!!!!!!!!!!!!!!!!!!"
   data = CreateObject("roSGNode", "ContentNode")

   for i = 1 to 5
       dataItem = data.CreateChild("SimpleListItemData")
       dataItem.posterUrl = "http://devtools.web.roku.com/samples/images/Portrait_2.jpg"
       dataItem.labelText = "This is list item " + stri(i)
       dataItem.label2Text = "Subitem " + stri(i)
   end for
   
   return data
end function

SimpleListItem.xml
function itemContentChanged() 
 ? "itemContentChanged!!!!!"
 itemData = m.top.itemContent
 m.itemImage.uri = itemData.posterUrl
 m.itemText.text = itemData.labelText
 m.item2Text.text = itemData.label2Text
 addItem()
end function

function init()
 m.itemImage = m.top.findNode("itemImage")
 m.itemText = m.top.findNode("itemText")
 m.item2Text = m.top.findNode("item2Text")
end function

function addItem()
 scene = m.global.scene
 ? "ITEM INDEX: "; scene.itemIndex
 if scene.rowHeights.count() = 0 then
     scene.rowHeights.append([0.0, 0.0, 0.0, 0.0, 0.0])
 end if
 scene.rowHeights[scene.itemIndex] = 50.0
 scene.simpleMarkupList.rowHeights = scene.rowHeights
 scene.itemIndex++
 m.global.scene = scene
end function

The thing is that if rowHeights for all list items set to 0 then itemContentChanged gets triggered one time less than needed. I got 5 items in the list and if I launch this code on OS 7.0 itemContentChanged ran 5 times, but if I launch it on OS 8.0 itemContentChanged ran 4 times and fifth time it ran when I moved focus from fourth item to fifth.

The code snippet above in addItem() doesn't make much sense but it describes the problem we have got on production app. Bug is not present on OS 7.0 and it is present on OS 8.0. Can this be fixed with the next OS build?

Thanks
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.