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

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 4
belltown
Roku Guru

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

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
Roku Guru

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)
0 Kudos
Arezth
Visitor

Re: Access ContentNode from MarkupGrid

Worked perfectly belltown, thank you!!
0 Kudos