Hi,
I attached a sample app showing my problem handling a Back or Up key in my app. The app puts 3 category names in the filter banner, and 3 items in the content list. To reproduce the problem, just run the app, move down from the filter banner to the first content item, and select it. The app will reset the categories and list items with a new menu, and from there if you press Back or Up, it will simply exit the app rather than getting handled in the roPosterScreenEvent message handler. The expected behavior is that it should print "isScreenClosed", return from the function, and redraw the parent menu.
'******************************************************************************
Function InitPosterScreen(screen As Object, level As String)
categoryArray = CreateObject("roArray", 5, true)
categoryArray[0] = "C1 " + level
categoryArray[1] = "C2 " + level
categoryArray[2] = "C3 " + level
screen.SetListNames(categoryArray)
screen.SetFocusedList(0)
itemsArray = CreateObject("roArray", 5, true)
item = CreateObject("roAssociativeArray")
item.ShortDescriptionLine1 = "Item1a" + level
item.ShortDescriptionLine2 = "Item1b" + level
itemsArray.Push(item)
item = CreateObject("roAssociativeArray")
item.ShortDescriptionLine1 = "Item2a" + level
item.ShortDescriptionLine2 = "Item2b" + level
itemsArray.Push(item)
item = CreateObject("roAssociativeArray")
item.ShortDescriptionLine1 = "Item3a" + level
item.ShortDescriptionLine2 = "Item3b" + level
itemsArray.Push(item)
screen.SetContentList(itemsArray)
screen.SetFocusedListItem(0)
End Function
'******************************************************************************
Function ShowMenu(screen As Object, level As String) As Integer
InitPosterScreen(screen, level)
screen.Show()
while true
msg = wait(0, screen.GetMessagePort())
if type(msg) = "roPosterScreenEvent" then
print "roPosterScreenEvent | msg = "; msg.GetMessage() " | index = "; msg.GetIndex()
if msg.isListFocused() then
print "Category focused | index = "; msg.GetIndex(); " | category = "; m.curCategory
else if msg.isButtonPressed() then
print "isButtonPressed" ; msg.GetIndex()
else if msg.isListItemSelected() then
print "isListItemSelected | index = "; msg.GetIndex()
' Show second level menu, Up or Back key should be handled in isScreenClosed() handler and return to caller.
print "Showing second level"
ShowMenu(screen, "- Level 2")
print "Done showing second level"
InitPosterScreen(screen, "- Level 1")
else if msg.isScreenClosed() then
print "isScreenClosed()"
return -1
end if
end If
end while
return 1
End Function
'******************************************************************************
Sub Main()
port = CreateObject("roMessagePort")
screen = CreateObject("roPosterScreen")
screen.SetMessagePort(port)
screen.SetListStyle("flat-category")
screen.setAdDisplayMode("scale-to-fit")
ShowMenu(screen, " - Level 1")
End Sub