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

Labellist count()?

Im doing some coding around jumpToItem in Labellist and want to go to the last element in the list.

Example:
lastItem = myList.count() - 1
myList.jumpToItem = lastItem




Usually i did a count on roList and subtracted one position and that was my last element. Is there something similar in LabelList? Do i have to count manually when doing the contentnode which will populate the labellist and keep a variable with that information or can i directly count the contentnode? Thanks.
0 Kudos
5 REPLIES 5
joetesta
Roku Guru

Re: Labellist count()?

https://sdkdocs.roku.com/display/sdkdoc/LabelList
Maybe you figured this out already?
use getChildCount() on the list.
So in the example from the LabelList page, you should be able to do something like

mylist = m.top.findnode("moviemenucontent")
count = mylist.getChildCount()
aspiring
Tags (1)
0 Kudos
adrianc1982
Visitor

Re: Labellist count()?

"joetesta" wrote:
https://sdkdocs.roku.com/display/sdkdoc/LabelList
Maybe you figured this out already?
use getChildCount() on the list.
So in the example from the LabelList page, you should be able to do something like

mylist = m.top.findnode("moviemenucontent")
count = mylist.getChildCount()


I havent figured it out, i will give it a try tonight and post my results. I also checked the sdk page for labelist and no, getchildcount() is not there, so maybe it should be added. thank you a lot for your kind response.
Tags (1)
0 Kudos
EnTerr
Roku Guru

Re: Labellist count()?

"adrianc1982" wrote:
I havent figured it out, i will give it a try tonight and post my results. I also checked the sdk page for labelist and no, getchildcount() is not there, so maybe it should be added. thank you a lot for your kind response.

getChildCount() comes from https://sdkdocs.roku.com/display/sdkdoc ... deChildren - which every Node supports.

All UI nodes are subclasses of Group, which is a subclass of Node, also known as roSgNode. The closest thing to a class diagram for RSG i have seen is actually... another question, https://forums.roku.com/viewtopic.php?f=34&t=95613 . Looking at that - only partial! - sketch, LabelList can do everything that ArrayGrid, Group and Node can do.

Using getChildCount() would be a bit of a hack, since it will count any direct children of LabelList - but as long as you haven't added extra dough there, it should do the job.
Tags (1)
0 Kudos
adrianc1982
Visitor

Re: Labellist count()?

"EnTerr" wrote:
"adrianc1982" wrote:
I havent figured it out, i will give it a try tonight and post my results. I also checked the sdk page for labelist and no, getchildcount() is not there, so maybe it should be added. thank you a lot for your kind response.

getChildCount() comes from https://sdkdocs.roku.com/display/sdkdoc ... deChildren - which every Node supports.

All UI nodes are subclasses of Group, which is a subclass of Node, also known as roSgNode. The closest thing to a class diagram for RSG i have seen is actually... another question, https://forums.roku.com/viewtopic.php?f=34&t=95613 . Looking at that - only partial! - sketch, LabelList can do everything that ArrayGrid, Group and Node can do.

Using getChildCount() would be a bit of a hack, since it will count any direct children of LabelList - but as long as you haven't added extra dough there, it should do the job.

I did work, its a hack because its not a count over labellist its a count of children from the content node. However it works and im happy thank you for your kind answers
Tags (1)
0 Kudos
joetesta
Roku Guru

Re: Labellist count()?

It's a count of child nodes (or sections) of the list content node itself. IMO It's not a hack because this list node will only ever have the correct number of contentnodes as its children. Although if one is using sections then you may want to get the counts from the section nodes.
aspiring
Tags (1)
0 Kudos
Community is Temporarily in Read-Only Mode!

We’re upgrading Roku Community to bring you a faster, more mobile-friendly experience. You may notice limited functionality or read-only access during this time. You will not be able to log in or post new comments or kudos during this time. Read more here.

Planned Downtime:
Community will be unavailable for up to 24–48 hours during the upgrade window during the week of May 12 and you may notice reduced functionality. In the meantime, for additional assistance, visit our Support Site.

Thanks for your patience — we’re excited to share what’s next!