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

Auto-close canvas

Been trying this for 2 hours now. Have a slideshow, and am replacing a messagedialog over each slide with an image canvas to make it look better. If you leave the info-canvas open it conflicts with the screensaver in that pressing a button to end the screensaver doesnt clear the screensaver, and shows the info-canvas - ugly. I tried closing the canvas in the screensaver function with a .Close() and with a separate function but it didnt seem to want to do that. So - i figure I'll put a close on the canvas with a sleep() timer. But i cant figure out where to put it where it doesnt stop something else from working. Have tried in the loop, out of the loop before and after, in its own loop, in a while inside the other while. Perhaps someone could point out where it ought to go. i'd sure appreciate it.
Function InfoCanvas(slideshow, infotype As Integer, curr_photo As Object, icanvas)

icanvas = CreateObject( "roImageCanvas" )
icanvas.setmessageport(createobject("romessageport"))

...........(canvas content)

icanvas.SetLayer( 1, [ url, text2, text3, text ] )
icanvas.Show()
slideshow.Pause() '' important function
GetURL_Image(curr_photo) '' important function

while true
msg = wait(0,icanvas.getmessageport())
if msg.isbuttonpressed()
button = msg.getindex()
print "Info Button ";button;" pressed"
if button = 4
slideshow.Resume()
return button
end if
end if

..........(other buttons)

if msg.isRemoteKeyPressed()
if msg.GetIndex() = 2
return 0
end if
end if

end while

End function
Kinetics Screensavers
0 Kudos
2 REPLIES 2
RokuJoel
Binge Watcher

Re: Auto-close canvas

Why not just implement the whole slideshow in imagecanvas instead of trying to using image canvas on top of the slideshow? That way, you can just use SetLayer to put your dialog on the topmost layer.

- Joel
0 Kudos
squirreltown
Roku Guru

Re: Auto-close canvas

Thanks for replying Joel, the short answer is that I've been developing for all of two months now and the idea of building a slideshow from scratch is a little beyond me and considering you all have provided us with slideshow component and I'm not unhappy with it, it doesn't seem necessary.
If you'd like to take a stab a how i can close that canvas layer after some minutes without screwing up the other functions, or even better why i cant close it from the screensaver functions even though the right variable is present i'd be grateful.
Kinetics Screensavers
0 Kudos