Forum Discussion
4 Replies
- xoceunderRoku Guru
how can I select category can load the content to insert the corresponding category
use and code
'handler of focused item in RowList Sub OnItemFocused() itemFocused=m.top.itemFocused focusedIndex = m.rowList.rowItemFocused ' get position of focused item row = m.rowList.content.GetChild(focusedIndex[0]) ' get all items of row 'When an item gains the key focus, set to a 2-element array, 'where element 0 contains the index of the focused row, 'and element 1 contains the index of the focused item in that row. If itemFocused.Count()=2 focusedContent=m.top.content.getChild(itemFocused[0]).getChild(itemFocused[1]) If focusedContent<>invalid m.top.focusedContent=focusedContent m.description.content=focusedContent m.background.uri=focusedContent.hdBackgroundImageUrl End If End If End Sub
- xoceunderRoku Guru
Here I leave my project to see if someone can help to make the independent categories load so I can quickly enter the section and thanks in advance
- xoceunderRoku Guru
' ********** Copyright 2016 Roku Corp. All Rights Reserved. ********** 'inits grid screen 'creates all children 'sets all observers Function Init() Print"[GridScreen] Init" m.rowList=m.top.findNode("RowList") m.description=m.top.findNode("Description") m.background=m.top.findNode("Background") m.background.setFocus(true) m.top.observeField("visible","onVisibleChange") m.top.observeField("focusedChild","OnFocusedChildChange") End Function 'handler of focused item in RowList Sub OnItemFocused() itemFocused=m.top.itemFocused focusedIndex = m.rowList.rowItemFocused ' get position of focused item row = m.rowList.content.GetChild(focusedIndex[0]) ' get all items of row item = row.GetChild(focusedIndex[1]) ' get focused item If itemFocused.Count()=2 focusedContent=m.top.content.getChild(itemFocused[0]).getChild(itemFocused[1]) print focusedContent If item<>invalid m.top.focusedContent=item m.description.content=item m.background.uri=item.hdBackgroundImageUrl End If End If If row.getChildCount()=0 print "children empty: " row.id numRows = 9 for i = 0 To numRows - 1 rowNew = CreateObject("rosgnode", "ContentNode") rowNew.title = "MOVIE ROW " + i.toStr() rowNew.HDPosterURL="https://image.tmdb.org/t/p/w300/jl8rZYy7JmbWlBlvDCfwvDmGO0g.jpg" m.rowList.content.insertChildren(rowNew, focusedIndex[0]) end for End If End Sub 'set proper focus to RowList in case if return from Details Screen Sub onVisibleChange() If m.top.visible=TRUE m.rowList.setFocus(TRUE) End If End Sub 'set proper focus to RowList in case if return from Details Screen Sub OnFocusedChildChange() If m.top.isInFocusChain() And Not m.rowList.hasFocus() m.rowList.setFocus(TRUE) End If End Sub
Trying to be able to insert Content Node to a tree that is without content, I don't know if I'm right or if I'm doing something wrong