Reputation: 818
I tried to show a dialog box. I create a Normal Application in Roku. In the main scene, Extends with the scene and I created a one-child inside the main scene and tried to show dialog box and also tried to scene inside a child and it extends with component name. Here I tried as mention belove three scenarios. The first Scenario Working But Two Scenario Generates Interface, not a member. I required to use dialog box inside a child or component. Is there any Solution For this.
First scenario:
main.xml
<component name="RokuApp" extends="Scene">
</component>
Below My dialog Box Logic
main.brs
sub init()
dialog = createObject("roSGNode", "Dialog")
dialog.backgroundUri = "pkg:/images/rsgde_dlg_bg_hd.9.png"
dialog.title = "Example Dialog"
dialog.optionsDialog = true
dialog.message = "Press * To Dismiss"
m.top.dialog = dialog
end init()
Second scenario :
main.xml inside a create one ChildNode/another XML and combine with the Roku App.
Child.xml
<component name="Child" extends="Group">
</component>
Child.brs
sub init()
dialog = createObject("roSGNode", "Dialog")
dialog.backgroundUri = "pkg:/images/rsgde_dlg_bg_hd.9.png"
dialog.title = "Example Dialog"
dialog.optionsDialog = true
dialog.message = "Press * To Dismiss"
m.top.dialog = dialog ' ' Interface not a member of BrightScript Component (runtime error &hf3)
end init()
Third Scenario :
main.xml inside a create one Component/another XML and combine with the Roku App.
Component.xml
<component name="Component" extends="RowList">
</component>
Component.brs
sub init()
dialog = createObject("roSGNode", "Dialog")
dialog.backgroundUri = "pkg:/images/rsgde_dlg_bg_hd.9.png"
dialog.title = "Example Dialog"
dialog.optionsDialog = true
dialog.message = "Press * To Dismiss"
m.top.dialog = dialog ' Interface not a member of BrightScript Component (runtime error &hf3)
end init()
But, Here above all three scenarios only extends with the scene is working fine. and in another, both case generates the error Interface, not a member of BrightScript Component (runtime error &hf3) anyone knows that solution.
Upvotes: 0
Views: 657
Reputation: 54
You can show dialog by using code below
m.resetDialog = createObject("roSGNode", "StandardMessageDialog")
m.resetDialog.title = "Reset All Levels!"
m.resetDialog.message = ["You are about to reset all progress that you have made in the Game. Do you wish to proceed?"]
m.resetDialog.buttons = ["Continue", "Cancel"]
' observe the dialog's buttonSelected field to handle button selections
m.resetDialog.observeFieldScoped("buttonSelected", "onResetButtonSelected")
' display the dialog
scene = m.top.getScene()
scene.dialog = m.resetDialog
and for button press control write this code
if m.resetDialog.buttonSelected = 0
' handle ok button here
m.resetDialog.close = true
else if m.resetDialog.buttonSelected = 1
' handle cancel button here
m.resetDialog.close = true
end if
you can use this code in groups too. Hope this will help you. Cheers
Upvotes: 2
Reputation: 1
Only Scene node has a field named "dialog". Group and RowList do not have a field named "dialog".
Upvotes: 0