jf-roku/components/config/list.xml

82 lines
1.8 KiB
XML
Raw Normal View History

2019-03-14 17:11:51 +00:00
<?xml version="1.0" encoding="utf-8" ?>
<component name="ConfigList" extends="MarkupList">
<interface>
2019-03-22 03:27:31 +00:00
<field id="configItems" type="nodearray" onChange="setData" />
2019-03-14 17:11:51 +00:00
</interface>
2019-03-22 03:27:31 +00:00
<script type="text/brightscript" uri="pkg:/source/utils/config.brs" />
2019-03-14 17:11:51 +00:00
<script type="text/brightscript">
<![CDATA[
sub init()
m.top.itemComponentName = "ConfigItem"
m.top.drawFocusFeedback = True
m.top.vertFocusAnimationStyle = "floatingFocus"
m.top.observeField("itemSelected", "onItemSelected")
2019-03-20 03:23:58 +00:00
m.top.itemSize = [1000, 80]
m.top.itemSpacing = [0, 20]
m.top.vertAlign = "middle"
2019-03-14 17:11:51 +00:00
m.top.setfocus(true)
end sub
2019-03-20 03:23:58 +00:00
function setData()
items = m.top.configItems
2019-03-14 17:11:51 +00:00
data = CreateObject("roSGNode", "ContentNode")
2019-03-22 03:27:31 +00:00
data.appendChildren(items)
2019-03-14 17:11:51 +00:00
m.top.content = data
end function
function onItemSelected()
i = m.top.itemSelected
itemField = m.top.content.getchild(i)
show_dialog(itemField)
end function
function onDialogButton()
d = m.dialog
button_text = d.buttons[d.buttonSelected]
if button_text = "OK"
m.configField.value = d.text
dismiss_dialog()
return true
else if button_text = "Cancel"
dismiss_dialog()
2019-03-14 22:20:16 +00:00
return true
2019-03-14 17:11:51 +00:00
end if
end function
sub show_dialog(configField)
dialog = createObject("roSGNode", "KeyboardDialog")
m.configField = configField
dialog.title = "Enter the " + configField.label
dialog.buttons = ["OK", "Cancel"]
2019-03-19 04:17:50 +00:00
if configField.type = "password"
2019-03-19 04:49:02 +00:00
dialog.keyboard.textEditBox.secureMode = true
2019-03-19 04:17:50 +00:00
end if
if configField.value <> ""
2019-03-14 17:11:51 +00:00
dialog.text = configField.value
end if
m.top.getparent().dialog = dialog
m.dialog = dialog
dialog.observeField("buttonSelected", "onDialogButton")
end sub
sub dismiss_dialog()
m.dialog.close = true
end sub
]]>
</script>
</component>