rado_ap
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2017
05:16 AM
How to access RowList elements?
Hello, I have a RowList, which renders some elements, each containing a Poster and a Label node. When an item has focus, I want to change the color of its label. How can I achieve that?
5 REPLIES 5
joetesta
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2017
11:56 AM
Re: How to access RowList elements?
you could do something like this:
In the component definition of your rowlist's itemComponentName item add:
And in the brs code of your rowlist's itemComponentName item put
In the above, m.top.getchild(0) references the item in the row, and m.top.getchild(0).getchild(1) references the title of that item.
(Although testing it, it's not the smoothest, there may be a better way but this may get you on the right track?)
In the component definition of your rowlist's itemComponentName item add:
<field id="focusPercent" type="float" onChange="onItemFocusChange"/>
And in the brs code of your rowlist's itemComponentName item put
sub onItemFocusChange()
if m.top.focusPercent <> invalid and m.top.focusPercent = 0 and m.top.getchild(0) <> invalid
m.top.getchild(0).getchild(1).color = "0xffffffff"
else if m.top.getchild(0) <> invalid
m.top.getchild(0).getchild(1).color = "0xff0000ff"
end if
end sub
In the above, m.top.getchild(0) references the item in the row, and m.top.getchild(0).getchild(1) references the title of that item.
(Although testing it, it's not the smoothest, there may be a better way but this may get you on the right track?)
aspiring
destruk
Streaming Star
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2017
02:33 PM
Re: How to access RowList elements?
Hey, that is some cool code Joe. 🙂
joetesta
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2017
06:18 PM
Re: How to access RowList elements?
are you making fun of my code? 
I found switching in `< 1` instead of '= 0' makes it a little smoother (only one label has the highlight color at a time)
I'm sure there's a way to do it so they transition simultaneously.
I tried using the 'rowItemFocused' field of the rowlist itself, but then the rowlist doesn't have access to the actual visible node defined under itemComponentName. I think using this field would smooth it out, believe it could be done with an observer set when the rowlist items are created.

I found switching in `< 1` instead of '= 0' makes it a little smoother (only one label has the highlight color at a time)
I'm sure there's a way to do it so they transition simultaneously.
I tried using the 'rowItemFocused' field of the rowlist itself, but then the rowlist doesn't have access to the actual visible node defined under itemComponentName. I think using this field would smooth it out, believe it could be done with an observer set when the rowlist items are created.
aspiring
rado_ap
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2017
11:43 PM
Re: How to access RowList elements?
Thanks, that was what I needed 🙂
destruk
Streaming Star
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2017
12:27 PM
Re: How to access RowList elements?
no, not making fun of your code, just I hadn't thought about doing it that way.