Forum Discussion
veerareddya
9 years agoVisitor
I am using screen.Close() method in the while loop. is this correct way i am doing ? and how to access the data from brs to xml scene??
ex: m.global.setField("tempmessage", "Are you sure you want to Signout?") I want access this "tempmessage" value in the ConfirmSignout.xml.
could you please help me on this..
Main.brs
sub ConfirmSignOUT() As Object
screen = CreateObject("roSGScreen")
m.port = CreateObject("roMessagePort")
screen.setMessagePort(m.port)
m.global = screen.getGlobalNode()
m.global.id="GlobalNode"
m.global.setField("tempmessage", "Are you sure you want to Signout?")
scene = screen.CreateScene("ConfirmSignout")
screen.show()
while(true)
msg = wait(1000, m.port)
if(scene.visible = false)
screen.Close()
return Invalid
endif
end while
End sub
ConfirmSignout.xml
<component name = "ConfirmSignout" extends = "Scene" >
<script type = "text/brightscript" >
<![CDATA[
sub init()
print "m.top";m.global.id
m.top.backgroundURI ="pkg:/images/rsgde_bg_hd.jpg"
dialog = createObject("roSGNode", "Dialog")
dialog.optionsDialog = false
dialog.title = "Alert"
dialog.message = m.global.tempmessage
dialog.buttons=["No","Yes"]
dialog.visible = true
m.top.dialog = dialog
end sub
sub dismissSignoutdialog()
m.top.dialog.close = true
m.top.visible = false
m.top.backExitsScene = false
end sub
function onKeyEvent(key as String, press as Boolean) as Boolean
handled = false
button_val = m.top.dialog.buttonSelected
if not press then
if key = "OK"
if(button_val = 0)
dismissSignoutdialog()
return true
else if (button_val = 1)
print "m.top";m.top
'return true
end if
else if key = "back"
m.top.backExitsScene = false
end if
end if
'return false
end function
]]>
</script>
<children >
<Label
id = "SignoutLable" />
</children>
</component>
ex: m.global.setField("tempmessage", "Are you sure you want to Signout?") I want access this "tempmessage" value in the ConfirmSignout.xml.
could you please help me on this..
Main.brs
sub ConfirmSignOUT() As Object
screen = CreateObject("roSGScreen")
m.port = CreateObject("roMessagePort")
screen.setMessagePort(m.port)
m.global = screen.getGlobalNode()
m.global.id="GlobalNode"
m.global.setField("tempmessage", "Are you sure you want to Signout?")
scene = screen.CreateScene("ConfirmSignout")
screen.show()
while(true)
msg = wait(1000, m.port)
if(scene.visible = false)
screen.Close()
return Invalid
endif
end while
End sub
ConfirmSignout.xml
<component name = "ConfirmSignout" extends = "Scene" >
<script type = "text/brightscript" >
<![CDATA[
sub init()
print "m.top";m.global.id
m.top.backgroundURI ="pkg:/images/rsgde_bg_hd.jpg"
dialog = createObject("roSGNode", "Dialog")
dialog.optionsDialog = false
dialog.title = "Alert"
dialog.message = m.global.tempmessage
dialog.buttons=["No","Yes"]
dialog.visible = true
m.top.dialog = dialog
end sub
sub dismissSignoutdialog()
m.top.dialog.close = true
m.top.visible = false
m.top.backExitsScene = false
end sub
function onKeyEvent(key as String, press as Boolean) as Boolean
handled = false
button_val = m.top.dialog.buttonSelected
if not press then
if key = "OK"
if(button_val = 0)
dismissSignoutdialog()
return true
else if (button_val = 1)
print "m.top";m.top
'return true
end if
else if key = "back"
m.top.backExitsScene = false
end if
end if
'return false
end function
]]>
</script>
<children >
<Label
id = "SignoutLable" />
</children>
</component>