Merge pull request #1456 from cewert/quickplay-search

This commit is contained in:
Charles Ewert 2023-10-31 17:05:34 -04:00 committed by GitHub
commit 44aac6bfe6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 1 deletions

View File

@ -41,6 +41,13 @@ sub loadResults()
m.searchSelect.itemdata = m.searchTask.results m.searchSelect.itemdata = m.searchTask.results
m.searchSelect.query = m.top.SearchAlpha m.searchSelect.query = m.top.SearchAlpha
m.searchHelpText.visible = false m.searchHelpText.visible = false
if m.searchTask.results.TotalRecordCount = 0
' make sure focus is on the keyboard
if m.searchSelect.isinFocusChain()
m.searchAlphabox.setFocus(true)
end if
return
end if
m.searchAlphabox = m.top.findnode("searchResults") m.searchAlphabox = m.top.findnode("searchResults")
m.searchAlphabox.translation = "[470, 85]" m.searchAlphabox.translation = "[470, 85]"
end sub end sub
@ -57,9 +64,21 @@ function onKeyEvent(key as string, press as boolean) as boolean
if key = "left" and m.searchSelect.isinFocusChain() if key = "left" and m.searchSelect.isinFocusChain()
m.searchAlphabox.setFocus(true) m.searchAlphabox.setFocus(true)
return true return true
else if key = "right" else if key = "right" and m.searchSelect.content <> invalid and m.searchSelect.content.getChildCount() > 0
m.searchSelect.setFocus(true) m.searchSelect.setFocus(true)
return true return true
else if key = "play" and m.searchSelect.isinFocusChain() and m.searchSelect.rowItemFocused.count() > 0
print "play was pressed from search results"
if m.searchSelect.rowItemFocused <> invalid
selectedContent = m.searchSelect.content.getChild(m.searchSelect.rowItemFocused[0])
if selectedContent <> invalid
selectedItem = selectedContent.getChild(m.searchSelect.rowItemFocused[1])
if selectedItem <> invalid
m.top.quickPlayNode = selectedItem
return true
end if
end if
end if
end if end if
return false return false

View File

@ -855,6 +855,7 @@ end function
function CreateSearchPage() function CreateSearchPage()
' Search + Results Page ' Search + Results Page
group = CreateObject("roSGNode", "searchResults") group = CreateObject("roSGNode", "searchResults")
group.observeField("quickPlayNode", m.port)
options = group.findNode("searchSelect") options = group.findNode("searchSelect")
options.observeField("itemSelected", m.port) options.observeField("itemSelected", m.port)