如何在Roku中的对话框中显示对话框?

时间:2020-01-09 05:58:30

标签: roku brightscript

我试图在Roku的对话框中显示像一个对话框。但无法正确显示。 我使用了以下代码。

sub showdialog()
  optiondialog = createObject("roSGNode", "Dialog")
  optiondialog.title = "Options"
  optiondialog.buttons=["Another Dialog","Exit"]  
  m.top.dialog = optiondialog
  m.top.dialog.observeField("buttonSelected","onVerifyOption")   
  m.top.dialog.setFocus(true)  

end sub

function onVerifyOption()
    if m.top.dialog.buttonSelected = 0
        m.top.dialog.visible = false
        m.top.dialog.close = true   
        anotherdialog= createObject("roSGNode", "Dialog")
        anotherdialog.backgroundUri = "pkg:/images/keyboardbackground.jpg"
        anotherdialog.title = "Another Dialog"
        anotherdialog.message = "new Dialog"
        m.dialog = anotherdialog
        m.dialog.observeField("buttonSelected","onAnother") 
        m.dialog.setFocus(true)  
  else if m.top.dialog.buttonSelected = 1
        ?"Exit Dialog"
  end if
    return true
end function

function onAnother()
    if m.top.dialog.buttonSelected = 0 
        m.top.dialog.visible = false
        m.top.dialog.setFocus(false)
        m.top.dialog.close = true
    end if  
    return true
end function

0 个答案:

没有答案