Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 
anilk1797
Level 7

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...
0 Kudos
5 Replies
EnTerr
Level 8

Re: How to use roImageCanvas in scene graph component

Tough.
The "scenography" is immiscible with most traditional components, see https://sdkdocs.roku.com/display/sdkdoc ... pt+Support for a list
0 Kudos
anilk1797
Level 7

Re: How to use roImageCanvas in scene graph component

"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?
0 Kudos
TheEndless
Level 7

Re: How to use roImageCanvas 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.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
EnTerr
Level 8

Re: How to use roImageCanvas in scene graph component

"Rarely is the question asked" Smiley Happy - but:
if SceneGraph is the answer... what exactly was the question?!
0 Kudos
anilk1797
Level 7

Re: How to use roImageCanvas in scene graph component

"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...
0 Kudos