2019-05-03 12:48:59 +00:00
|
|
|
sub init()
|
|
|
|
m.top.layoutDirection = "vert"
|
|
|
|
m.top.horizAlignment = "center"
|
|
|
|
m.top.vertAlignment = "top"
|
2019-10-13 20:52:34 +00:00
|
|
|
m.top.visible = false
|
|
|
|
|
|
|
|
show_dialog()
|
2019-05-03 12:48:59 +00:00
|
|
|
end sub
|
|
|
|
|
|
|
|
function onKeyEvent(key as string, press as boolean) as boolean
|
|
|
|
if not press then return false
|
|
|
|
|
|
|
|
if key = "OK"
|
|
|
|
' Make a Keyboard Dialog here
|
|
|
|
show_dialog()
|
|
|
|
return true
|
|
|
|
end if
|
|
|
|
|
|
|
|
return false
|
|
|
|
end function
|
|
|
|
|
|
|
|
function onDialogButton()
|
|
|
|
d = m.top.getScene().dialog
|
|
|
|
button_text = d.buttons[d.buttonSelected]
|
|
|
|
|
2020-05-05 21:09:18 +00:00
|
|
|
if button_text = tr("Search")
|
2019-05-03 12:48:59 +00:00
|
|
|
m.top.search_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
|
|
|
|
|
|
|
|
return false
|
|
|
|
end function
|
|
|
|
|
|
|
|
sub show_dialog()
|
|
|
|
dialog = CreateObject("roSGNode", "KeyboardDialog")
|
2020-05-05 21:09:18 +00:00
|
|
|
dialog.title = tr("Search")
|
|
|
|
dialog.buttons = [tr("Search"), tr("Cancel")]
|
2019-05-03 12:48:59 +00:00
|
|
|
|
|
|
|
m.top.getScene().dialog = dialog
|
|
|
|
|
|
|
|
dialog.observeField("buttonselected", "onDialogButton")
|
|
|
|
end sub
|
|
|
|
|
|
|
|
sub dismiss_dialog()
|
|
|
|
m.top.getScene().dialog.close = true
|
2020-05-05 21:09:18 +00:00
|
|
|
end sub
|