Set up flow for search

This commit is contained in:
Nick Bisby 2019-03-14 17:20:16 -05:00
parent a2f4df9884
commit 7bc6d969fa
No known key found for this signature in database
GPG Key ID: F6E0C4E6D0B5EB36
4 changed files with 40 additions and 2 deletions

View File

@ -49,7 +49,7 @@
return true
else if button_text = "Cancel"
dismiss_dialog()
return false
return true
end if
end function

View File

@ -6,6 +6,7 @@
</children>
<interface>
<field id="escape" type="boolean" alwaysNotify="true" />
<field id="search_value" type="string" />
</interface>
<script type="text/brightscript">
<![CDATA[
@ -22,7 +23,8 @@
if key = "OK"
' Make a Keyboard Dialog here
print "KEYBOARD"
show_dialog()
return true
else if key = "up"
m.top.findNode("search-input").active = false
m.top.escape = true
@ -31,6 +33,37 @@
return false
end function
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
]]>
</script>
</component>

View File

@ -29,6 +29,8 @@ sub themeScene(scene)
overhang = scene.findNode("overhang")
if overhang <> invalid
overhang.logoUri = "pkg:/images/logo.png"
overhang.showOptions = true
overhang.optionsAvailable = true
end if
end sub

View File

@ -95,6 +95,7 @@ sub ShowLibrarySelect()
search = scene.findNode("search")
search.observeField("escape", port)
search.observeField("search_value", port)
while(true)
msg = wait(0, port)
@ -102,6 +103,8 @@ sub ShowLibrarySelect()
exit while
else if nodeEventQ(msg, "escape") and msg.getNode() = "search"
library.setFocus(true)
else if nodeEventQ(msg, "search_value")
print "Searching for: " + msg.getRoSGNode().search_value
else if nodeEventQ(msg, "itemSelected")
target = getMsgRowTarget(msg)
if target.libraryType = "movies"