jf-roku/components/data/options-choices.xml

43 lines
1.1 KiB
XML
Raw Normal View History

2019-03-18 00:17:54 +00:00
<?xml version="1.0" encoding="utf-8" ?>
<component name="OptionsData" extends="ContentNode">
<interface>
<field id="base_title" type="string" />
<field id="choices" type="array" />
2019-03-18 00:17:54 +00:00
<field id="config_key" type="string" />
<field id="value_index" type="integer" />
<field id="value" type="string" onChange="update_title" />
2019-03-19 04:17:50 +00:00
<function name="press" />
2019-03-18 00:17:54 +00:00
</interface>
2019-03-22 03:27:31 +00:00
<script type="text/brightscript" uri="pkg:/source/utils/config.brs" />
2019-03-18 00:17:54 +00:00
<script type="text/brightscript">
<![CDATA[
sub init()
m.top.value_index = 0
end sub
sub update_title()
for i=0 to m.top.choices.count() - 1
if m.top.choices[i].value = m.top.value
2019-03-18 00:17:54 +00:00
m.top.value_index = i
exit for
end if
end for
m.top.title = m.top.base_title + ": " + m.top.choices[m.top.value_index].display
2019-03-18 00:17:54 +00:00
end sub
2019-03-19 04:17:50 +00:00
sub press()
2019-03-18 00:17:54 +00:00
max_opt = m.top.choices.count()
i = m.top.value_index + 1
while i >= max_opt
i = i - max_opt
end while
m.top.value_index = i
m.top.value = m.top.choices[m.top.value_index].value
2019-03-18 00:17:54 +00:00
set_user_setting(m.top.config_key, m.top.value)
end sub
]]>
</script>
</component>