adrianc1982
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2017
08:10 AM
Labellist count()?
Im doing some coding around jumpToItem in Labellist and want to go to the last element in the list.
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.
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.
5 REPLIES 5
joetesta
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2017
10:20 AM
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
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
adrianc1982
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2017
02:42 PM
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 likemylist = 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.
EnTerr
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2017
07:16 PM
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.
adrianc1982
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2017
09:52 PM
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
joetesta
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2017
08:43 PM
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