Your Digital Media Has Never Looked So Good

 
xoceunder
Topic Author
Posts: 41
Joined: Wed Dec 14, 2016 4:08 pm

error functions in SceneGraph components?

Mon May 15, 2017 9:18 am

I have a problem executing a dialog

HomeScene.brs
'********** Copyright 2016 Roku Corp.  All Rights Reserved. **********
'inits grid screen
'creates all children
'sets all observers
Function Init()
 Print "[HomeScene] Init"
 
 'GridScreen node with RowList
 m.GridScreen=m.top.findNode("GridScreen")
 m.GridScreen.Visible=FALSE
 
 'SeriesScreen node with RowList
 m.SeriesGridScreen=m.top.findNode("GridScreen")
 m.SeriesGridScreen.Visible=FALSE

 'GridScreen node with RowList
 m.epgGrid=m.top.findNode("epgGrid")
 m.epgGrid.Visible=FALSE

 'DetailsScreen Node with description, Video Player
 m.detailsScreen=m.top.findNode("DetailsScreen")
 
 'Observer to handle Item selection on RowList inside GridScreen (alias="GridScreen.rowItemSelected")
 m.top.observeField("rowItemSelected", "OnRowItemSelected")
 m.top.ObserveField("isSubdialog", "On_msgDialog_error")
 
 'loading indicator starts at initializatio of channel
 m.loadingIndicator=m.top.findNode("loadingIndicator")
 m.loadingIndicator.opacity=0
 
 
 m.ParseGrid=m.top.findnode("ParseGrid")
 
 'Create main labellist menu
 m.MainMenu=m.top.findNode("MainMenuBackground")
 m.MainMenu.Visible=TRUE
 m.MainMenu.getChild(1).SetFocus(TRUE) 'Set focus to the list options
 'm.MainMenu.show = true
 
End Function



Function MainMenuSelectionMade() 'interface for the main menu screen
Print m.MainMenu.getChild(1).itemselected.toStr()

 'second option is Adults
 If m.MainMenu.getChild(1).itemSelected=4
 showPinAdults()
 End If
 
End Function

'Row item selected handler interface for the grid content
Function OnRowItemSelected()
 'On select any item on home scene, show Details node and hide Grid
 print "OnRowItemSelected =>> ";m.gridScreen.focusedContent.contenttype
 ID=m.gridScreen.focusedContent.id
 contentID=m.gridScreen.focusedContent.contenttype
End Function

'Main Remote keypress event loop
Function OnKeyEvent(key, press) As Boolean
 Print ">>> HomeScene >> OnkeyEvent"
 result=FALSE
 If press
 If key="ok"
 Print"OK Pressed"
 'Print m.top.content.TITLE
 'Print m.itemfocused
 If m.top.dialog<>invalid m.top.dialog=invalid
 result=TRUE
 Else If key="options"
 result=TRUE
 Else If key="back"
 'exit channel if we're on the top selection screen and the user pressed back
 If m.MainMenu.Visible=TRUE
    print "Exit Channel"
                showExitConfirmationDialog()
 result=TRUE
 
 'if Details opened
 Else If m.epgGrid.Visible=FALSE And m.GridScreen.visible=FALSE AND m.SeriesGridScreen.visible=FALSE And m.detailsScreen.videoPlayerVisible=FALSE
 
    print "Exiting from Details opened"
 m.GridScreen.visible=TRUE
 m.detailsScreen.visible=FALSE
 m.GridScreen.setFocus(TRUE)
 result=TRUE
 
 'if video player opened
 Else If m.epgGrid.Visible=FALSE And m.GridScreen.visible=FALSE And m.detailsScreen.videoPlayerVisible=TRUE
 
    print "video player opened"
 m.detailsScreen.videoPlayerVisible=FALSE
 result=TRUE
 
 'Exiting from epgGrid to get back to the main selection menu
 Else If m.epgGrid.Visible=TRUE And m.GridScreen.Visible=FALSE And m.MainMenu.Visible=FALSE
 
    print "Exiting from epgGrid"
 m.epgGrid.Visible=FALSE
 m.MainMenu.Visible=TRUE
 m.MainMenu.getChild(1).SetFocus(TRUE)
 result=TRUE
 
 'Exiting from Gridscreens to get back to the main selection menu
 Else If m.epgGrid.Visible=FALSE And m.GridScreen.Visible=TRUE And m.MainMenu.Visible=FALSE
 
    print "Exiting from Gridscreens"
 m.GridScreen.Visible=FALSE
 m.MainMenu.Visible=TRUE
 m.MainMenu.getChild(1).SetFocus(TRUE)
 result=TRUE
 
 End If
 End If
 End If
 Return result
End Function

Function DismissDialog()
 m.top.dialog=invalid
End Function

Function setUnFocusCall()
    'print "setUnlinkFocusCallback =>> " m.top.LinkingURL
End Function

sub showExitConfirmationDialog()
    dialog = createObject("roSGNode", "Dialog")
    dialog.message = "Are you sure you want to exit?"
    dialog.buttons = ["Cancel", "Exit"]
    dialog.observeField("buttonSelected", "onDialogButtonSelected")
    m.top.dialog = dialog
end sub

sub onDialogButtonSelected()
    if m.top.dialog.buttonSelected = 1
        m.top.close = true
    else
        m.top.dialog.close = true
    end if
end sub

sub showPinAdults()
    pinDialog = createObject("roSGNode", "PinDialog")
    pinDialog.title = "Enter the Pin"
 pindialog.backgroundUri = "pkg:/images/rsgde_dlg_bg_hd.9.png"
    pinDialog.buttons = ["Ok","Cancel"]
 pindialog.pinPad.pinLength = 4
    pindialog.observeField("buttonSelected","onVerifyPin")
    m.top.dialog = pinDialog
End sub

sub onVerifyPin()
 Print ">>> HomeScene >> VerifyPin"
 
 print "Pin User =>>";m.top.PinUser " Pin Selected =>>";m.top.dialog.pin
 
    if m.top.dialog.buttonSelected = 0
       print "ok button pressed"
   if m.top.PinUser = m.top.dialog.pin then
   
     print "Pin Correct"
  
     m.top.dialog.close = true
     m.top.isAuthorized = true
  
       else
   
      print "Pin Incorrect"
  
  m.top.dialog.close = true
  m.top.isAuthorized = false
  m.top.isSubdialog = true
  
       end if
   
    else
 
       print "cancel button pressed"
   m.top.dialog.close = true
   m.top.isAuthorized = false
   
    end if
 
end sub

' onChange handler for "show" field
sub On_show_isAuthorized()
    print "On_show_isAuthorized"
 print "Autorizacion ";m.top.isAuthorized

end sub

sub On_msgDialog_error()

    msgDialog = CreateObject("roSGNode", "BackDialog")
    msgDialog.buttons = ["Retry"]
    'msgDialog.buttonGroup.focusBitmapUri = "pkg:/images/button_on.9.png"
    msgDialog.ObserveField("buttonSelected", "On_msgDialog_buttonSelected")
    msgDialog.title = "Pin Incorecto"
    m.top.dialog = msgDialog

end sub

sub On_msgDialog_buttonSelected()
    if m.top.dialog <> invalid then m.top.dialog.close = true

end sub

The problem is here
sub On_msgDialog_error()

    msgDialog = CreateObject("roSGNode", "BackDialog")
    msgDialog.buttons = ["Retry"]
    'msgDialog.buttonGroup.focusBitmapUri = "pkg:/images/button_on.9.png"
    msgDialog.ObserveField("buttonSelected", "On_msgDialog_buttonSelected")
    msgDialog.title = "Pin Incorecto"
    m.top.dialog = msgDialog

end sub
 
xoceunder
Topic Author
Posts: 41
Joined: Wed Dec 14, 2016 4:08 pm

Re: error functions in SceneGraph components?

Wed May 17, 2017 1:57 pm

Any help please

Who is online

Users browsing this forum: No registered users and 6 guests