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: 
RokuJoel
Binge Watcher

Re: Beta Scene Graph Components

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
0 Kudos

Re: Beta Scene Graph Components

"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 ?
0 Kudos
menghao
Visitor

Re: Beta Scene Graph Components

"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?
0 Kudos

Re: Beta Scene Graph Components

"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?


Hello menghao,
Add your code here, maybe I can give you some directions .
0 Kudos
menghao
Visitor

Re: Beta Scene Graph Components

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.
0 Kudos

Re: Beta Scene Graph Components

"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 .
0 Kudos
menghao
Visitor

Re: Beta Scene Graph Components

"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 .


Hi dude, amazing, this actually worked, the constants of size are defined as arrays, and when I push them separately like the way you suggested, it's worked. I have to explicitly tell it that it is the array I want to push.
0 Kudos

Re: Beta Scene Graph Components

I'm not sure what's the reason behind this, but at least it works and you don't have to change much .Glad it helped
0 Kudos
menghao
Visitor

Re: Beta Scene Graph Components

Cheers 8-) !
0 Kudos
EnTerr
Roku Guru

Re: Beta Scene Graph Components

@menghao, @dacian_roman23 -
guys, seems to me you pinpointed another bug in SG. Can you please try and see what's the input from this:
? 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)?

My prediction is at least one of the four types will differ. (And no, i could not guess what exactly that is, since no idea how exactly containerSize was created initially)
0 Kudos