Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
anilk1797
Visitor

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 5
EnTerr
Roku Guru

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
Visitor

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
Channel Surfer

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
Roku Guru

Re: How to use roImageCanvas in scene graph component

"Rarely is the question asked" 🙂 - but:
if SceneGraph is the answer... what exactly was the question?!
0 Kudos
anilk1797
Visitor

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
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.