2019-03-14 17:11:51 +00:00
|
|
|
<?xml version="1.0" encoding="utf-8" ?>
|
|
|
|
<component name="SearchBox" extends="LayoutGroup">
|
|
|
|
<children>
|
|
|
|
<Label text="Search" />
|
2019-03-14 21:50:42 +00:00
|
|
|
<TextEditBox id="search-input" width="800" maxTextLength="75" />
|
2019-03-14 17:11:51 +00:00
|
|
|
</children>
|
2019-03-14 21:50:42 +00:00
|
|
|
<interface>
|
|
|
|
<field id="escape" type="boolean" alwaysNotify="true" />
|
2019-03-16 22:11:50 +00:00
|
|
|
<field id="search_value" type="string" alwaysNotify="true" />
|
2019-03-14 21:50:42 +00:00
|
|
|
</interface>
|
2019-03-14 17:11:51 +00:00
|
|
|
<script type="text/brightscript">
|
|
|
|
<![CDATA[
|
|
|
|
sub init()
|
|
|
|
m.top.layoutDirection = "vert"
|
|
|
|
dimensions = m.top.getScene().currentDesignResolution
|
|
|
|
m.top.translation = [dimensions.width / 2, 880]
|
|
|
|
m.top.horizAlignment = "center"
|
|
|
|
m.top.vertAlignment = "top"
|
|
|
|
end sub
|
|
|
|
|
2019-03-14 21:50:42 +00:00
|
|
|
function onKeyEvent(key as string, press as boolean) as boolean
|
|
|
|
if not press then return false
|
|
|
|
|
|
|
|
if key = "OK"
|
|
|
|
' Make a Keyboard Dialog here
|
2019-03-14 22:20:16 +00:00
|
|
|
show_dialog()
|
|
|
|
return true
|
2019-03-14 21:50:42 +00:00
|
|
|
else if key = "up"
|
|
|
|
m.top.findNode("search-input").active = false
|
|
|
|
m.top.escape = true
|
|
|
|
return true
|
|
|
|
end if
|
|
|
|
|
|
|
|
return false
|
|
|
|
end function
|
2019-03-14 22:20:16 +00:00
|
|
|
|
|
|
|
function onDialogButton()
|
|
|
|
d = m.top.getScene().dialog
|
|
|
|
button_text = d.buttons[d.buttonSelected]
|
|
|
|
|
|
|
|
if button_text = "Search"
|
|
|
|
m.top.search_value = d.text
|
|
|
|
dismiss_dialog()
|
|
|
|
return true
|
|
|
|
else if button_text = "Cancel"
|
|
|
|
dismiss_dialog()
|
|
|
|
return true
|
|
|
|
end if
|
|
|
|
|
|
|
|
return false
|
|
|
|
end function
|
|
|
|
|
|
|
|
sub show_dialog()
|
|
|
|
dialog = CreateObject("roSGNode", "KeyboardDialog")
|
|
|
|
dialog.title = "Search"
|
|
|
|
dialog.buttons = ["Search", "Cancel"]
|
|
|
|
|
|
|
|
m.top.getScene().dialog = dialog
|
|
|
|
|
|
|
|
dialog.observeField("buttonselected", "onDialogButton")
|
|
|
|
end sub
|
|
|
|
|
|
|
|
sub dismiss_dialog()
|
|
|
|
m.top.getScene().dialog.close = true
|
|
|
|
|
|
|
|
end sub
|
2019-03-14 17:11:51 +00:00
|
|
|
]]>
|
|
|
|
</script>
|
|
|
|
</component>
|