Clean up a lot of Config scenes etc

This commit is contained in:
Nick Bisby 2019-03-19 22:23:58 -05:00
parent d8018e564b
commit 7cb5dfd5c6
No known key found for this signature in database
GPG Key ID: F6E0C4E6D0B5EB36
4 changed files with 50 additions and 38 deletions

View File

@ -1,49 +1,61 @@
<?xml version="1.0" encoding="utf-8" ?>
<component name="ConfigItem" extends="Group">
<children>
<LayoutGroup
layoutDirection="horiz"
vertAlignment="center"
itemSpacings="20"
translation="[8,40]" >
<Label id="label"
horizAlign="left"
width="196"
height="60"
color="#666666" />
<Label id="value"
horizAlign="left"
width="196"
height="60"
color="#666666" />
<LayoutGroup layoutDirection="horiz" >
<Label id="label" />
<TextEditBox id="value" />
</LayoutGroup>
</children>
<interface>
<field id="itemContent" type="node" onChange="itemContentChanged" />
<field id="itemHasFocus" type="boolean" onChange="setColors" />
</interface>
<script type="text/brightscript">
<![CDATA[
sub Init()
sub init()
m.name = m.top.findNode("label")
m.value = m.top.findNode("value")
m.top.layoutDirection = "horiz"
m.top.vertAlignment = "top"
m.name.width = 250
m.name.height = 80
m.name.vertAlign = "center"
m.name.horizAlign = "center"
' TODO - calculate "width" better... this is total item - (label + spacings)
m.value.width = 1000 - 230
m.value.height = 80
m.value.hintText = "Enter a value..."
m.value.maxTextLength = 100
end sub
sub itemContentChanged() as void
sub itemContentChanged()
data = m.top.itemContent
m.name.text = data.label
if data.value = ""
m.value.color = "#444444"
m.value.text = "Enter a value..."
else if data.type = "password"
m.value.color = "#ffffff"
m.value.text = "********"
else
m.value.color = "#ffffff"
m.value.text = data.value
if data.type = "password"
m.value.secureMode = true
end if
m.value.text = data.value
end sub
sub setColors()
if m.top.itemHasFocus
color = "#101010FF"
else
color = "#ffffffFF"
end if
m.name.color = color
m.value.textColor = color
end sub
]]>
</script>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<component name="ConfigList" extends="MarkupList">
<interface>
<function name="setData" />
<field id="configItems" type="array" onChange="setData" />
</interface>
<script type="text/brightscript" uri="pkg:/source/config.brs" />
<script type="text/brightscript">
@ -14,11 +14,16 @@
m.top.observeField("itemSelected", "onItemSelected")
m.top.itemSize = [1000, 80]
m.top.itemSpacing = [0, 20]
m.top.vertAlign = "middle"
m.top.setfocus(true)
end sub
function setData(items)
function setData()
items = m.top.configItems
data = CreateObject("roSGNode", "ContentNode")
for each item in items

View File

@ -3,21 +3,16 @@
<children>
<label text="Enter Configuration"
id="prompt"
height="70"
font="font:MediumBoldSystemFont"
font="font:LargeBoldSystemFont"
translation="[150, 150]" />
<ConfigList
id="configOptions"
translation="[150, 250]"
itemSize="[440, 40]"
itemSpacing="[0, 20]"
numRows="12" />
translation="[150, 250]" />
<Button
id="submit"
text="Submit"
showFocusFootprint="false"
translation="[150, 350]"
/>
translation="[150, 450]" />
</children>
<script type="text/brightscript" uri="pkg:/components/config/scene.brs"/>
</component>

View File

@ -13,7 +13,7 @@ sub ShowServerSelect()
{"field": "server", "label": "Host", "type": "string"},
{"field": "port", "label": "Port", "type": "string"}
]
config.callfunc("setData", items)
config.configItems = items
button = scene.findNode("submit")
button.observeField("buttonSelected", port)
@ -51,7 +51,7 @@ sub ShowSignInSelect()
{"field": "username", "label": "Username", "type": "string"},
{"field": "password", "label": "Password", "type": "password"}
]
config.callfunc("setData", items)
config.configItems = items
button = scene.findNode("submit")
button.observeField("buttonSelected", port)