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: 
Arezth
Level 7

Access ContentNode from MarkupGrid

Hi Forum,

I am trying to access a specific item (ContentNode) from the MarkupGrid I made. I know I can acquire the number of the item I am accessing through markupgrid.itemFocused, but I was wondering how to get that specific node (selected on the grid) so I can acccess it from another .brs through a <field> on <interface>. I assume there should be a way to access through itemContent, but I haven't been able to find it.

As always, thank you for your help.
0 Kudos
4 Replies
belltown
Level 7

Re: Access ContentNode from MarkupGrid

I'm not sure I totally understand you, but it sounds like you're describing an alias:

<interface>
 <field id="specificNode" type="node" alias="markupgrid.itemFocused" />
</interface>
https://github.com/belltown/
0 Kudos
Arezth
Level 7

Re: Access ContentNode from MarkupGrid

Thank you for answering belltown. I want to do something of that sort, but ".itemFocused" returns an integer. I am assigning a whole contentNode to each position on the grid, and I want to access the info of that contentNode (like .itemFocused but someway to return the content node rather than an integer), but I don't know how. With ".itemFocused" I know to which of the grid they gave click to, but how to I access the information of that node in the grid?

I hope I had make myself a bit clearer. Thank you for your help!
0 Kudos
belltown
Level 7

Re: Access ContentNode from MarkupGrid

I see now. You'll need two interface field aliases: one for the grid content, and one for itemFocused. Here's what I use in one of my PosterGrid elements:

<interface>
 <field id="content"       type="node"     alias="mainPosterGrid.content" />
 <field id="itemFocused"   type="integer"  alias="mainPosterGrid.itemFocused" value="0" />
</interface>

Then in the code that accesses the grid you can do something like:

item = m.gridNode.content.GetChild(m.gridNode.itemFocused)
https://github.com/belltown/
0 Kudos
Arezth
Level 7

Re: Access ContentNode from MarkupGrid

Worked perfectly belltown, thank you!!
0 Kudos