"roSGEng" wrote:
There is a bug in RowList that I've found and fixed. The problem was that setting the rowHeights field was not causing the clipping rectangles for each row to be recomputed.
I'll check the fix in <for the future> In the meantime, in the example, in main.brs, if they move the line that sets rowList.data after the line that sets the rowHeights, things should work. Specifically, move this:
rowList.data =
{ grid: buildRowGrid() numRows: 10 }
after this line:
rowList.rowHeights = rowHeights
In general, it's best to not set any list or grid's content field until all of the sizing/positioning fields (e.g. itemSize, itemSpacing, rowHeights, rowItemSize, etc.) have been set. That minimizes the amount of recomputation that needs to be done.
"RokuJoel" wrote:
Here is what I've got:"roSGEng" wrote:
There is a bug in RowList that I've found and fixed. The problem was that setting the rowHeights field was not causing the clipping rectangles for each row to be recomputed.
I'll check the fix in <for the future> In the meantime, in the example, in main.brs, if they move the line that sets rowList.data after the line that sets the rowHeights, things should work. Specifically, move this:
rowList.data =
{ grid: buildRowGrid() numRows: 10 }
after this line:
rowList.rowHeights = rowHeights
In general, it's best to not set any list or grid's content field until all of the sizing/positioning fields (e.g. itemSize, itemSpacing, rowHeights, rowItemSize, etc.) have been set. That minimizes the amount of recomputation that needs to be done.
Hope that helps.
- Joel
function getRowItemSizeDimension()
return [ [264,110], [264,149], [165,247], [264,149], [264,149], [264,149], [165,247], [165,247], [165,247], [264,149] ]
end function
"dacian_roman23" wrote:"RokuJoel" wrote:
Here is what I've got:"roSGEng" wrote:
There is a bug in RowList that I've found and fixed. The problem was that setting the rowHeights field was not causing the clipping rectangles for each row to be recomputed.
I'll check the fix in <for the future> In the meantime, in the example, in main.brs, if they move the line that sets rowList.data after the line that sets the rowHeights, things should work. Specifically, move this:
rowList.data =
{ grid: buildRowGrid() numRows: 10 }
after this line:
rowList.rowHeights = rowHeights
In general, it's best to not set any list or grid's content field until all of the sizing/positioning fields (e.g. itemSize, itemSpacing, rowHeights, rowItemSize, etc.) have been set. That minimizes the amount of recomputation that needs to be done.
Hope that helps.
- Joel
Maybe there was a bug with the rowHeight attribute, but I still can't understand what is wrong with the rowItemSize attribute. Regarding the previous post , why do I get a type mismatch error when trying to set the rowItemSize with the printed values ? Trying to set the values of the rowItemSize like this : homeScreenRowList.rowItemSize = getRowItemSizeDimensions() it works fine and i don't get the type mismatch error.
function getRowItemSizeDimension()
return [ [264,110], [264,149], [165,247], [264,149], [264,149], [264,149], [165,247], [165,247], [165,247], [264,149] ]
end function
But if my function is based on a json response passed as parameter and some conditions, even if the returned values are the ones listed in the line above I get the type mismatch error.What could be a possible cause/solution to this ?
"menghao" wrote:"dacian_roman23" wrote:"RokuJoel" wrote:
Here is what I've got:"roSGEng" wrote:
There is a bug in RowList that I've found and fixed. The problem was that setting the rowHeights field was not causing the clipping rectangles for each row to be recomputed.
I'll check the fix in <for the future> In the meantime, in the example, in main.brs, if they move the line that sets rowList.data after the line that sets the rowHeights, things should work. Specifically, move this:
rowList.data =
{ grid: buildRowGrid() numRows: 10 }
after this line:
rowList.rowHeights = rowHeights
In general, it's best to not set any list or grid's content field until all of the sizing/positioning fields (e.g. itemSize, itemSpacing, rowHeights, rowItemSize, etc.) have been set. That minimizes the amount of recomputation that needs to be done.
Hope that helps.
- Joel
Maybe there was a bug with the rowHeight attribute, but I still can't understand what is wrong with the rowItemSize attribute. Regarding the previous post , why do I get a type mismatch error when trying to set the rowItemSize with the printed values ? Trying to set the values of the rowItemSize like this : homeScreenRowList.rowItemSize = getRowItemSizeDimensions() it works fine and i don't get the type mismatch error.
function getRowItemSizeDimension()
return [ [264,110], [264,149], [165,247], [264,149], [264,149], [264,149], [165,247], [165,247], [165,247], [264,149] ]
end function
But if my function is based on a json response passed as parameter and some conditions, even if the returned values are the ones listed in the line above I get the type mismatch error.What could be a possible cause/solution to this ?
Dude I have the exact same problem with you. And I found out that beside the predefined array, it actually accept the calculated array with less than 3 items. I guess the only possible solution is to let people in Roku fix this ASAP?
Sub onContentChange()
m.containers.rowItemSize = getContainerSize()
m.containers.content = m.top.containerContent
End Sub
Function getContainerSize() as Object
' containerSize = [[180,270],[180,180],[270,270],[270,180],[180,270],[180,180],[270,270],[270,180]]
containerSize = []
For i = 0 To m.top.containerContent.getChildCount() - 1
containerType = m.top.containerContent.getChild(i).templateId
if containerType = m.constants.LANDSCAPE_SHELF
containerSize.push(m.constants.CONTAINER_SIZE.LANDSCAPE_SHELF)
else if containerType = m.constants.PORTRAIT_SHELF
containerSize.push(m.constants.CONTAINER_SIZE.PORTRAIT_SHELF)
else
containerSize.push(m.constants.CONTAINER_SIZE.CAROUSEL)
end if
End For
return containerSize
End function
"menghao" wrote:Sub onContentChange()
m.containers.rowItemSize = getContainerSize()
m.containers.content = m.top.containerContent
End Sub
Function getContainerSize() as Object
' containerSize = [[180,270],[180,180],[270,270],[270,180],[180,270],[180,180],[270,270],[270,180]]
containerSize = []
For i = 0 To m.top.containerContent.getChildCount() - 1
containerType = m.top.containerContent.getChild(i).templateId
if containerType = m.constants.LANDSCAPE_SHELF
containerSize.push(m.constants.CONTAINER_SIZE.LANDSCAPE_SHELF)
else if containerType = m.constants.PORTRAIT_SHELF
containerSize.push(m.constants.CONTAINER_SIZE.PORTRAIT_SHELF)
else
containerSize.push(m.constants.CONTAINER_SIZE.CAROUSEL)
end if
End For
return containerSize
End function
I try to set the rowItemSize based on the data I got from some server, then I got type mismatch runtime error.
However, I did some experiment on it and got some interesting result. Firstly, if I use this predefined value [[180,270],[180,180],[270,270],[270,180],[180,270],[180,180],[270,270],[270,180]] as containerSize, it will pass. Same as you mentioned.
Secondly, If I change "m.top.containerContent.getChildCount() - 1" in the loop to 2, it will work, no mismatch error, if I change to 3 or higher than it will complain about the mismatch error. By the way, the size of the array I tried here is 11.
if containerType = m.constants.LANDSCAPE_SHELF
containerSize.push([m.constants.CONTAINER_SIZE.LANDSCAPE_WIDTH, m.constants.CONTAINER_SIZE.LANDSCAPE_HEIGHT])
else if containerType = m.constants.PORTRAIT_SHELF
containerSize.push([m.constants.CONTAINER_SIZE.PORTRAIT_WIDTH, m.constants.CONTAINER_SIZE.PORTRAIT_HEIGHT])
else
containerSize.push([m.constants.CONTAINER_SIZE.CAROUSEL_WIDTH, m.constants.CONTAINER_SIZE.CAROUSEL_HEIGHT])
end if
"dacian_roman23" wrote:"menghao" wrote:Sub onContentChange()
m.containers.rowItemSize = getContainerSize()
m.containers.content = m.top.containerContent
End Sub
Function getContainerSize() as Object
' containerSize = [[180,270],[180,180],[270,270],[270,180],[180,270],[180,180],[270,270],[270,180]]
containerSize = []
For i = 0 To m.top.containerContent.getChildCount() - 1
containerType = m.top.containerContent.getChild(i).templateId
if containerType = m.constants.LANDSCAPE_SHELF
containerSize.push(m.constants.CONTAINER_SIZE.LANDSCAPE_SHELF)
else if containerType = m.constants.PORTRAIT_SHELF
containerSize.push(m.constants.CONTAINER_SIZE.PORTRAIT_SHELF)
else
containerSize.push(m.constants.CONTAINER_SIZE.CAROUSEL)
end if
End For
return containerSize
End function
I try to set the rowItemSize based on the data I got from some server, then I got type mismatch runtime error.
However, I did some experiment on it and got some interesting result. Firstly, if I use this predefined value [[180,270],[180,180],[270,270],[270,180],[180,270],[180,180],[270,270],[270,180]] as containerSize, it will pass. Same as you mentioned.
Secondly, If I change "m.top.containerContent.getChildCount() - 1" in the loop to 2, it will work, no mismatch error, if I change to 3 or higher than it will complain about the mismatch error. By the way, the size of the array I tried here is 11.
Instead of pushing , m.constants.CONTAINER_SIZE.LANDSCAPE_SHELF, m.constants.CONTAINER_SIZE.PORTRAIT_SHELF and m.constants.CONTAINER_SIZE.CAROUSEL which I assume are defined as arrays, try to define the values as floats...something like CONTAINER_SIZE.LANDSCAPE_WIDTH, CONTAINER_SIZE.LANDSCAPE_HEIGHT, m.constants.CONTAINER_SIZE.PORTRAIT_WIDTH, m.constants.CONTAINER_SIZE.PORTRAIT_HEIGHT ..etc and the push them in an array, something like this :
if containerType = m.constants.LANDSCAPE_SHELF
containerSize.push([m.constants.CONTAINER_SIZE.LANDSCAPE_WIDTH, m.constants.CONTAINER_SIZE.LANDSCAPE_HEIGHT])
else if containerType = m.constants.PORTRAIT_SHELF
containerSize.push([m.constants.CONTAINER_SIZE.PORTRAIT_WIDTH, m.constants.CONTAINER_SIZE.PORTRAIT_HEIGHT])
else
containerSize.push([m.constants.CONTAINER_SIZE.CAROUSEL_WIDTH, m.constants.CONTAINER_SIZE.CAROUSEL_HEIGHT])
end if
Let me know if this works .
? type(containerSize[0]), type(containerSize[0], 3), type(containerSize[0][0]), type(containerSize[0][0], 3)in each of the two cases (i.e. the one that did not work and the one which works if you manually re-create)?