Add an options side panel
This commit is contained in:
parent
04fc7e71be
commit
3658f0b77f
|
@ -94,6 +94,14 @@
|
|||
if key = "down" and (m.top.itemFocused + 1) = m.top.content.getChildCount()
|
||||
m.top.getScene().findNode("pager").setFocus(true)
|
||||
m.top.getScene().findNode("pager").getChild(0).setFocus(true)
|
||||
return true
|
||||
else if key = "options"
|
||||
options = m.top.getScene().findNode("options")
|
||||
list = options.findNode("panelList")
|
||||
|
||||
options.visible = true
|
||||
list.setFocus(true)
|
||||
|
||||
return true
|
||||
end if
|
||||
|
||||
|
|
|
@ -11,5 +11,8 @@
|
|||
/>
|
||||
<Rectangle id="footerBackdrop" />
|
||||
<Pager id="pager" />
|
||||
|
||||
<OptionsSlider id="options" />
|
||||
|
||||
</children>
|
||||
</component>
|
||||
|
|
61
components/options.xml
Normal file
61
components/options.xml
Normal file
|
@ -0,0 +1,61 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<component name="OptionsSlider" extends="PanelSet">
|
||||
<children>
|
||||
<ListPanel id="panel">
|
||||
<Rectangle id="backdrop" />
|
||||
<LabelList id="panelList">
|
||||
<ContentNode id="fieldList" role="content" />
|
||||
</LabelList>
|
||||
</ListPanel>
|
||||
</children>
|
||||
<interface>
|
||||
<field id="options" type="nodearray" onChange="setFields" />
|
||||
<field id="escape" type="boolean" alwaysNotify="true" />
|
||||
</interface>
|
||||
<script type="text/brightscript">
|
||||
<![CDATA[
|
||||
sub init()
|
||||
m.top.visible = false
|
||||
|
||||
panel = m.top.findNode("panel")
|
||||
panel.panelSize = "small"
|
||||
panel.leftPosition = 0
|
||||
panel.focusable = true
|
||||
panel.hasNextPanel = false
|
||||
panel.leftOnly = true
|
||||
|
||||
list = m.top.findNode("panelList")
|
||||
|
||||
panel.list = list
|
||||
|
||||
bd = m.top.findNode("backdrop")
|
||||
bd.color = "#101010DD"
|
||||
bd.translation = [0, 0]
|
||||
dimensions = m.top.getScene().currentDesignResolution
|
||||
bd.width = 575
|
||||
bd.height = dimensions.height
|
||||
end sub
|
||||
|
||||
sub setFields()
|
||||
options = m.top.options
|
||||
row = m.top.findNode("fieldList")
|
||||
|
||||
row.removeChildren(row.getChildren(-1, 0))
|
||||
|
||||
row.appendChildren(options)
|
||||
end sub
|
||||
|
||||
function onKeyEvent(key as string, press as boolean) as boolean
|
||||
if not press then return false
|
||||
|
||||
if key = "options"
|
||||
m.top.visible = false
|
||||
m.top.escape = true
|
||||
return true
|
||||
end if
|
||||
|
||||
return false
|
||||
end function
|
||||
]]>
|
||||
</script>
|
||||
</component>
|
|
@ -168,12 +168,33 @@ sub ShowMovieOptions(library)
|
|||
pager.observeField("escape", port)
|
||||
pager.observeField("pageSelected", port)
|
||||
|
||||
sidepanel = scene.findNode("options")
|
||||
movie_options = [
|
||||
{"title": "Sort Field",
|
||||
"key": "movie_sort_field",
|
||||
"values": ["blah", "this", "that"]},
|
||||
{"title": "Sort Order",
|
||||
"key": "movie_sort_order",
|
||||
"values": ["blah", "this", "that"]}
|
||||
]
|
||||
new_options = []
|
||||
for each opt in movie_options
|
||||
o = CreateObject("roSGNode", "ContentNode")
|
||||
o.title = opt.title
|
||||
new_options.append([o])
|
||||
end for
|
||||
sidepanel.options = new_options
|
||||
|
||||
sidepanel.observeField("escape", port)
|
||||
|
||||
while true
|
||||
msg = wait(0, port)
|
||||
if type(msg) = "roSGScreenEvent" and msg.isScreenClosed() then
|
||||
return
|
||||
else if nodeEventQ(msg, "escape") and msg.getNode() = "pager"
|
||||
options.setFocus(true)
|
||||
else if nodeEventQ(msg, "escape") and msg.getNode() = "options"
|
||||
options.setFocus(true)
|
||||
else if nodeEventQ(msg, "pageSelected") and pager.pageSelected <> invalid
|
||||
pager.pageSelected = invalid
|
||||
page_num = int(val(msg.getData().id))
|
||||
|
|
Loading…
Reference in New Issue
Block a user