commit 6de081f27c4f6202029337676c1d79bcfa27f546
parent 528b680e94f9134eac78e21569454301d21b09db
Author: Brian C. Lane <bcl@brianlane.com>
Date:   Sun, 13 Nov 2022 16:37:35 -0800
Switch to PanelSet
Trying to make a list on the left and a grid of posters on the right.
This moves to using PanelSet and ListPanel which is mostly working.
Not sure why there is so much space around the list though, I set it to
0,0 but it is offset to the right and down quite a bit.
https://developer.roku.com/docs/references/scenegraph/sliding-panels-nodes/panelset.md
https://developer.roku.com/docs/references/scenegraph/sliding-panels-nodes/listpanel.md
Diffstat:
2 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/HMS/components/MainScene.brs b/HMS/components/MainScene.brs
@@ -31,8 +31,15 @@ sub OnCategoriesLoaded()
     m.categories = m.contentTask.categories
 
     ' Add these to the list on the left side of the screen... how?
-    m.topmenu = m.top.FindNode("topmenu")
-    m.topmenu.vertFocusAnimationStyle = "floatingFocus"
+    m.panels = m.top.FindNode("panels")
+    m.listPanel = m.panels.CreateChild("ListPanel")
+    m.listPanel.observeField("createNextPanelIndex", "OnCreateNextPanelIndex")
+
+    m.labelList = CreateObject("roSGNode", "LabelList")
+    m.labelList.observeField("focusedItem", "OnLabelListSelected")
+    m.listPanel.list = m.labelList
+    m.listPanel.appendChild(m.labelList)
+    m.listPanel.SetFocus(true)
 
     ln = CreateObject("roSGNode", "ContentNode")
     for each item in m.categories:
@@ -40,8 +47,16 @@ sub OnCategoriesLoaded()
         n.title = item
         ln.appendChild(n)
     end for
-    m.topmenu.content = ln
-    m.topmenu.SetFocus(true)
+    m.labelList.content = ln
+end sub
+
+sub OnCreateNextPanelIndex()
+    print "MainScene->OnCreateNextPanelIndex()"
+    print m.listPanel.createNextPanelIndex
+end sub
+
+sub OnLabelListSelected()
+    print "MainScene->OnLabelListSelected()"
 end sub
 
 sub RunValidateURLTask(url as string)
diff --git a/HMS/components/MainScene.xml b/HMS/components/MainScene.xml
@@ -9,6 +9,6 @@
         <field id="categories" type="roArray" />
     </interface>
     <children>
-        <LabelList id="topmenu" />
+        <PanelSet id="panels" translation="[0, 0]" />
     </children>
 </component>