2019-02-11 04:40:07 +00:00
|
|
|
sub init()
|
|
|
|
m.top.backgroundColor = "#000b35ff"
|
|
|
|
m.top.backgroundURI = ""
|
|
|
|
|
|
|
|
m.top.setFocus(true)
|
2019-02-18 22:44:17 +00:00
|
|
|
end sub
|
|
|
|
|
2019-03-06 02:28:52 +00:00
|
|
|
function onKeyEvent(key as String, press as Boolean) as Boolean
|
|
|
|
if not press then return false
|
|
|
|
list = m.top.findNode("configOptions")
|
|
|
|
button = m.top.findNode("submit")
|
|
|
|
if key = "down" and button.focusedChild = invalid
|
|
|
|
limit = list.content.getChildren(-1, 0).count() - 1
|
|
|
|
|
|
|
|
if limit = list.itemFocused
|
|
|
|
m.top.setFocus(false)
|
|
|
|
button.setFocus(true)
|
|
|
|
return true
|
|
|
|
end if
|
|
|
|
else if key = "up" and button.focusedChild <> invalid
|
|
|
|
list.setFocus(true)
|
|
|
|
return true
|
|
|
|
end if
|
|
|
|
return false
|
|
|
|
end function
|
|
|
|
|
2019-02-18 22:44:17 +00:00
|
|
|
function onDialogButton()
|
|
|
|
d = m.top.dialog
|
|
|
|
button_text = d.buttons[d.buttonSelected]
|
|
|
|
|
|
|
|
if button_text = "OK"
|
|
|
|
m.focused_item.text = d.text
|
|
|
|
dismiss_dialog()
|
|
|
|
return true
|
|
|
|
else if button_text = "Cancel"
|
|
|
|
dismiss_dialog()
|
|
|
|
return false
|
|
|
|
end if
|
|
|
|
end function
|
|
|
|
|
|
|
|
|
|
|
|
sub show_dialog(title as String)
|
|
|
|
dialog = createObject("roSGNode", "KeyboardDialog")
|
|
|
|
dialog.title = "Enter the " + m.focused_item.id
|
|
|
|
dialog.buttons = ["OK", "Cancel"]
|
|
|
|
|
|
|
|
if m.focused_item.text <> "" then
|
|
|
|
dialog.text = m.focused_item.text
|
|
|
|
end if
|
|
|
|
|
|
|
|
m.top.dialog = dialog
|
|
|
|
|
|
|
|
dialog.observeField("buttonSelected", "onDialogButton")
|
|
|
|
end sub
|
|
|
|
|
|
|
|
sub dismiss_dialog()
|
|
|
|
m.top.dialog.close = true
|
2019-02-11 04:40:07 +00:00
|
|
|
end sub
|