Forum Discussion

squirreltown's avatar
squirreltown
Roku Guru
12 years ago

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
No RepliesBe the first to reply