I can't explain what is happening. I'm experimenting with combining some of the traditional poster screens with the new scene API.
Here's some sample code, where the first screen presents a list of icons, and once you click an icon, it launches a scene. The problem is that when I back out of the scene (using back button), it ALSO backs out of the first poster screen. The port on the first poster screen receives a screen close event for no apparent reason:
Function showHomeScreen()
port = CreateObject("roMessagePort")
screen = CreateObject("roPosterScreen")
screen.SetMessagePort(port)
screen.SetListStyle("flat-category")
screen.SetListDisplayMode("photo-fit")
actions = buildMainActions()
screen.SetContentList(actions)
screen.Show()
while true
msg = wait(0, screen.GetMessagePort())
if type(msg) = "roPosterScreenEvent"
if msg.isListItemSelected()
actionType = actions[msg.GetIndex()]["type"]
if actionType = "categories"
showCategoryScreen(m.categories)
end if
else if msg.isScreenClosed()
exit while
end if
end If
end while
End Function
Function showCategoryScreen(categories)
screen = CreateObject("roSGScreen")
port = CreateObject("roMessagePort")
screen.setMessagePort(port)
scene = screen.CreateScene("SimpleRowListScene")
screen.show()
while(true)
msg = wait(0, port)
msgType = type(msg)
if msgType = "roSGScreenEvent"
if msg.isScreenClosed()
exit while
end if
end if
end while
End Function
There's some other code in there that's not important to demonstrate the example. So, I can successfully get the category scene to launch. When I back out of it, an event is fired for closing the screen and the while loop is exited. At that point I would expect the user to be shown the original poster screen and can perform another action. Instead, they are presented with the screen briefly but it closes as well! It received an event that closed the screen as well.
Can anyone explain that?