How to use roImageCanvas in scene graph component

Hello,

I am using Scene Graph Component to develop a application with MarkupList and MarkupGrid. I want a custom dialog box open when user exit from application. I am using roImageCanvas to create custom dialog box but don’t know how to implement this. My main.brs file code is…

sub main()
screen = CreateObject(“roSGScreen”)
m.port = CreateObject(“roMessagePort”)
screen.setMessagePort(m.port)
scene = screen.CreateScene(“HomeScene”)
screen.show()

while(true)
msg = wait(1000, m.port)
msgType = type(msg)
if msgType = “roSGScreenEvent”

if msg.isScreenClosed() then showImageCanvas()
end if
end while
end sub

and roImageCanvas code is…

Sub showImageCanvas()
print “sdfsdf”
canvasItems = [
{
url:“http://192.168.1.23/boardwalk.jpg
TargetRect:{x:100,y:100,w:400,h:300}
},
{
url:“http://192.168.1.23/walking.jpg
TargetRect:{x:500,y:400,w:400,h:300}
},
{
Text:“Hello ImageCanvas”
TextAttrs:{Color:“#FFCCCCCC”, Font:“Medium”,
HAlign:“HCenter”, VAlign:“VCenter”,
Direction:“LeftToRight”}
TargetRect:{x:390,y:357,w:500,h:60}
}
]

canvas = CreateObject(“roImageCanvas”)
port = CreateObject(“roMessagePort”)
canvas.SetMessagePort(port)
'Set opaque background
canvas.SetLayer(0, {Color:“#FF000000”, CompositionMode:“Source”})
canvas.SetRequireAllImagesToDraw(true)
canvas.SetLayer(1, canvasItems)
canvas.Show()
while(true)
msg = wait(0,port)
if type(msg) = “roImageCanvasEvent” then
if (msg.isRemoteKeyPressed()) then
i = msg.GetIndex()
print "Key Pressed - " ; msg.GetIndex()
if (i = 2) then
’ Up - Close the screen.
canvas.close()
end if
else if (msg.isScreenClosed()) then
print “Closed”
return
end if
end if
end while
End Sub

Generally i want when user exit from app showImageCanvas() should be called. I have also tried to put showImageCanvas() code in Scene file but it’s always giving error so please help…

Tough.
The “scenography” is immiscible with most traditional components, see https://sdkdocs.roku.com/display/sdkdoc … pt+Support for a list

“EnTerr” wrote:
Tough.
The “scenography” is immiscible with most traditional components, see https://sdkdocs.roku.com/display/sdkdoc … pt+Support for a list

Is there another way to use custom dialog box in scene graph component?

Using roImageCanvas kind of defeats the purpose of using SceneGraph in the first place. You should probably either customize the SceneGraph dialog component or create your own custom dialog component.

“Rarely is the question asked” :slightly_smiling_face: - but:
if SceneGraph is the answer… what exactly was the question?!

“TheEndless” wrote:
Using roImageCanvas kind of defeats the purpose of using SceneGraph in the first place. You should probably either customize the SceneGraph dialog component or create your own custom dialog component.

Thank you for reply…