validate search quick play node and return focus after a query with no results

This commit is contained in:
Charles Ewert 2023-10-31 16:11:56 -04:00
parent 034c485990
commit fd9b50ca3f

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
@ -63,10 +70,16 @@ function onKeyEvent(key as string, press as boolean) as boolean
else if key = "play" and m.searchSelect.isinFocusChain() and m.searchSelect.rowItemFocused.count() > 0 else if key = "play" and m.searchSelect.isinFocusChain() and m.searchSelect.rowItemFocused.count() > 0
print "play was pressed from search results" print "play was pressed from search results"
if m.searchSelect.rowItemFocused <> invalid if m.searchSelect.rowItemFocused <> invalid
m.top.quickPlayNode = m.searchSelect.content.getChild(m.searchSelect.rowItemFocused[0]).getChild(m.searchSelect.rowItemFocused[1]) 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 return true
end if end if
end if end if
end if
end if
return false return false
end function end function