sub Main()
' create and display a roPosterScreen as a backdrop
screen = CreateObject("roPosterScreen")
port = CreateObject("roMessagePort")
screen.SetMessagePort(port)
screen.Show()
' create our roMessageDialog
dialog = CreateObject("roMessageDialog")
' give the dialog the same message port as the poster screen so we can get events from both
dialog.SetMessagePort(port)
' set the text of the dialog
dialog.SetTitle("Application test")
dialog.SetText("This application is just a test to make buttons and the back arrow work. The layout has not been set yet.")
' add some buttons
' assign them different indexes so we can tell them apart
' when we handle their respective isButtonPressed() events
dialog.AddButton(1, "Channel Guide")
dialog.AddButton(2, "Exit")
dialog.SetMenuTopLeft(true)
dialog.EnableOverlay(true)
' display the dialog
dialog.Show()
' event loop
while true
msg = wait(0, port) ' wait for an event
' make sure the message we got is of the type we are expecting
if type(msg) = "roMessageDialogEvent"
if(msg.isButtonPressed()) then
buttonIndex = msg.GetIndex()
if(buttonIndex = 1)
Second()
else if(buttonIndex = 2)
print "Exit application"
return
end if
dialog.Close()
end if
end if
end while
end sub
Sorry, as i just added two buttons to the SDK example i thought i didn't need to post a lot of code. This is my new main page. The function Second() that i call when i click on the button is the Main() function of the videoplayer example from the SDK i have renamed. I didn't change the rest of the code.
I have removed the isScreenClosed() event because it is defined in the appPosterScreen.brs, so i wanted to see if i was not creating a conflict between the two files, but it didn't change the problem, only the up arrow is working.
As for the return value, i had a compiling error if i used "return -1' that told me i couldn't return a value in a void function.