2019-05-03 12:48:59 +00:00
|
|
|
sub init()
|
|
|
|
m.top.itemComponentName = "ConfigItem"
|
|
|
|
|
|
|
|
m.top.drawFocusFeedback = True
|
|
|
|
m.top.vertFocusAnimationStyle = "floatingFocus"
|
|
|
|
|
|
|
|
m.top.observeField("itemSelected", "onItemSelected")
|
|
|
|
|
2020-01-04 21:37:06 +00:00
|
|
|
m.top.itemSize = [750, 75]
|
|
|
|
m.top.itemSpacing = [0, 25]
|
2019-05-03 12:48:59 +00:00
|
|
|
|
|
|
|
m.top.setfocus(true)
|
|
|
|
|
|
|
|
end sub
|
|
|
|
|
|
|
|
function setData()
|
|
|
|
items = m.top.configItems
|
|
|
|
data = CreateObject("roSGNode", "ContentNode")
|
|
|
|
data.appendChildren(items)
|
|
|
|
|
|
|
|
m.top.content = data
|
|
|
|
end function
|
|
|
|
|
|
|
|
function onItemSelected()
|
2019-10-13 19:33:14 +00:00
|
|
|
print "HI"
|
2019-05-03 12:48:59 +00:00
|
|
|
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]
|
|
|
|
|
2020-05-05 21:09:18 +00:00
|
|
|
if button_text = tr("OK")
|
2019-05-03 12:48:59 +00:00
|
|
|
m.configField.value = d.text
|
|
|
|
dismiss_dialog()
|
|
|
|
return true
|
2020-05-05 21:09:18 +00:00
|
|
|
else if button_text = tr("Cancel")
|
2019-05-03 12:48:59 +00:00
|
|
|
dismiss_dialog()
|
|
|
|
return true
|
|
|
|
end if
|
|
|
|
end function
|
|
|
|
|
|
|
|
|
|
|
|
sub show_dialog(configField)
|
|
|
|
dialog = createObject("roSGNode", "KeyboardDialog")
|
|
|
|
m.configField = configField
|
|
|
|
dialog.title = "Enter the " + configField.label
|
2020-05-05 21:09:18 +00:00
|
|
|
dialog.buttons = [tr("OK"), tr("Cancel")]
|
2019-05-03 12:48:59 +00:00
|
|
|
|
|
|
|
if configField.type = "password"
|
|
|
|
dialog.keyboard.textEditBox.secureMode = true
|
|
|
|
end if
|
|
|
|
|
|
|
|
if configField.value <> ""
|
|
|
|
dialog.text = configField.value
|
|
|
|
end if
|
|
|
|
|
2019-10-13 19:33:14 +00:00
|
|
|
m.top.getscene().dialog = dialog
|
2019-05-03 12:48:59 +00:00
|
|
|
m.dialog = dialog
|
|
|
|
|
|
|
|
dialog.observeField("buttonSelected", "onDialogButton")
|
|
|
|
end sub
|
|
|
|
|
|
|
|
sub dismiss_dialog()
|
|
|
|
m.dialog.close = true
|
2020-01-04 21:37:06 +00:00
|
|
|
end sub
|