0

I have created ConfirmSignout.xml scene in. main.brs to show some dialog pop-up with two buttons. If I call dismissSignoutdialog() in onKeyevent, pop-up and rosgscreen has to close and focus will be on the previous screen. But for me if I call dismissSignoutdialog(), rosgscreen is not getting closed.

could anyone help me on this.

Main.brs

sub ConfirmSignOUT() As Object
    screen = CreateObject("roSGScreen")
    m.port = CreateObject("roMessagePort")
    screen.setMessagePort(m.port)
    scene = screen.CreateScene("ConfirmSignout")
    screen.show()
    while(true)
        msg = wait(0, m.port)
        msgType = type(msg)
        if msgType = "roSGScreenEvent"
          if msg.isScreenClosed() then 
            return -1
            exit while
          end if 
        end if
    end while
End sub

ConfirmSignout.xml

<component name = "ConfirmSignout" extends = "Scene" >
  <script type = "text/brightscript" >
    <![CDATA[
     sub init()
        m.top.backgroundURI ="pkg:/images/rsgde_bg_hd.jpg"
        dialog = createObject("roSGNode", "Dialog")
        'dialog.backgroundUri = "pkg:/images/rsgde_dlg_bg_hd.9.png"
        dialog.optionsDialog = false
        dialog.title = "Alert"
        dialog.message = "Are you sure you want to Signout?"
        dialog.buttons=["No","Yes"]
        dialog.visible = true
        m.top.dialog = dialog
    end sub

    sub dismissSignoutdialog()
        m.top.dialog.close = true
    end sub

    function onKeyEvent(key as String, press as Boolean) as Boolean
        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  
            end if
        end if
      'return false
    end function

    ]]>

  </script>

  <children >

    <Label
      id = "SignoutLable" />

  </children>

</component>
A.V REDDY
  • 55
  • 6
  • print ``msgType and ``msg – Renjith V R Dec 22 '16 at 17:24
  • So this is a signout page? You wanted to sign out and close the page and redirect to some other page. Right? You can use `group` for this. And do you think your `onKeyEvent` function is correct? What do you mean by `if not press`' and you are again saying ` key = "OK"` . the key won't work till `press` is true – Renjith V R Dec 22 '16 at 17:46
  • I am new user for BrightScript. I would like to implement onKeyEvent( ) in one of my Test.brs file. I this possible to do that without mentioning onKeyEvent( ) function in any script file. I am just putting onKeyEvent( ) in Test.brs file but function is not getting called while pressing remote buttons. Please help... – Maddy Sharma Mar 14 '18 at 06:18
  • @Maddy your issue is solved or it's pending? – Nikunj Chaklasiya Jul 31 '19 at 05:55

0 Answers0