lock_4815162342
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2017
01:54 PM
SceneGraph move from multi row grid to single row grid(SimpleGridWithDetailsAndVideo example)
I am trying to learn SceneGraph. I have been manipulating the SimpleGridWithDetailsAndVideo sample and have been able to make some changes. I have the first grid as a standard full-screen grid and make it so that if you click on an item in the grid the user is brought to a different grid that includes an image preview at the top of the screen along with the description. I also have been able to load in different content than what is provided.
I would like this second grid screen to only contain a single row from the first grid screen. Currently, the content is set with:
I have been digging through and experimenting with this node but I have been unable to find a way set only a single row to my grid content. :shock:
How can I set only a single row in my second grid? Can I reference a single row of the grid content from this example? :?:
Thank you very much for taking the time to read this. Any information at all is very appreciated. 🙂 🙂
:?ps: I have tried just running a new function in HomeScreen to pull in the single row that I want but I am running into thread problems. Apparently, you can't do a lot of things in these scene functions. If you have any information on this front it would also be very appreciated. For example, how would I reference a function from another brs file from the OnRowItemSelected() function in the HomeScene brs? :?: I think the answer is you can't but I am confused at what the flow should be for this. I don't know what I want until the user clicks.
I would like this second grid screen to only contain a single row from the first grid screen. Currently, the content is set with:
m.gridScreen2.content = m.gridScreen.content
I have been digging through and experimenting with this node but I have been unable to find a way set only a single row to my grid content. :shock:
How can I set only a single row in my second grid? Can I reference a single row of the grid content from this example? :?:
Thank you very much for taking the time to read this. Any information at all is very appreciated. 🙂 🙂
:?ps: I have tried just running a new function in HomeScreen to pull in the single row that I want but I am running into thread problems. Apparently, you can't do a lot of things in these scene functions. If you have any information on this front it would also be very appreciated. For example, how would I reference a function from another brs file from the OnRowItemSelected() function in the HomeScene brs? :?: I think the answer is you can't but I am confused at what the flow should be for this. I don't know what I want until the user clicks.
4 REPLIES 4
joetesta
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2017
04:43 PM
Re: SceneGraph move from multi row grid to single row grid(SimpleGridWithDetailsAndVideo example)
Haven't tested it but think this would work:
You can include that other brs file in the HomeScene's XML, https://forums.roku.com/viewtopic.php?f=34&t=105446
contentNode = createObject("RoSGNode","ContentNode")
row1 = m.gridScreen.content.getChild(0)
contentNode.appendChild(row1)
m.gridScreen2.content = contentNode
how would I reference a function from another brs file from the OnRowItemSelected() function in the HomeScene brs?
You can include that other brs file in the HomeScene's XML, https://forums.roku.com/viewtopic.php?f=34&t=105446
aspiring
lock_4815162342
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2017
09:21 AM
Re: SceneGraph move from multi row grid to single row grid(SimpleGridWithDetailsAndVideo example)
Thank you so much for the advice. It has been very helpful.
I am running into an issue. When I append the child to contentNode it removes the child from m.gridScreen.content. I am confused as to why this is happening. I checked and it is not being removed when I only run getChild() it is the appendChild() that is removing it. It doesn't seem like this is something that should be happening.
Can you give me an idea why this is happening? Is there another method that would be better to use?
Thank you for taking the time to read this. Any information will be very appreciated.
I am running into an issue. When I append the child to contentNode it removes the child from m.gridScreen.content. I am confused as to why this is happening. I checked and it is not being removed when I only run getChild() it is the appendChild() that is removing it. It doesn't seem like this is something that should be happening.
Can you give me an idea why this is happening? Is there another method that would be better to use?
Thank you for taking the time to read this. Any information will be very appreciated.
lock_4815162342
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2017
11:25 AM
Re: SceneGraph move from multi row grid to single row grid(SimpleGridWithDetailsAndVideo example)
As an added note, I thought that I would be slick and just add the child back to the original gridScreen. To my surprise when I do this it removes the child or row from gridScreen2. It seems that the child can only exist in one place. I also tried setting the child to a different variable and I got the same results.
Is there a way to clone a child so that it can be used in more than one place? Am I just going about this all wrong? :shock:
Thank you for taking the time to read this. Any information that you can offer will be very appreciated. 🙂
Is there a way to clone a child so that it can be used in more than one place? Am I just going about this all wrong? :shock:
Thank you for taking the time to read this. Any information that you can offer will be very appreciated. 🙂
joetesta
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2017
02:55 PM
Re: SceneGraph move from multi row grid to single row grid(SimpleGridWithDetailsAndVideo example)
yes it's because nodes are always "passed by reference" meaning there is only one instance of any given node and when you set a variable equal to the node, it's really just a pointer. There are workarounds such as copying the non-node contents bit by bit, or retaining the original data and regenerating a new node from it.
aspiring