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: 
Highlighted
PTKDev
Level 7

Delete DrawObject

If i use DrawObject in roScreen, is possibile delete this object in a second time?


screen = CreateObject("roScreen")
screen.SetMessagePort(port)
screen.Clear(&hFFFFFF00)
bitmap=CreateObject("roBitmap", "pkg:/images/header.png")
id = screen.DrawObject(0, 124, bitmap) 'this line is bad, how i replace it for get id of element?
screen.show()

' ========= HOW REPLACE THIS BAD CODE WITH CORRECT CODE? EXAMPLE DELETE DRAWOBJECT IF I PRESS UP BUTTON ========
while true
msg = wait(0, port)
if type(msg) = "roUniversalControlEvent" then
code = msg.GetInt()

if (code = 0) 'back button
return -1
else if (code = 2) 'up button
screen.DeleteObject(id) 'this line is bad, how i replace it for delete element from id?
end if

end if
end while
'=============================================
Regards,
Patryk Rzucidlo (PTKDev)

Find me on social, forum and app with nickname "PTKDev".
Portfolio: http://www.ptkdev.it
Skype: ptkdev | Twitter: @ptkdev | LinkedIN: ptkdev | CurriculumVitae: http://cv.ptkdev.it
0 Kudos
2 Replies
squirreltown
Level 9

Re: Delete DrawObject

showobject = 1

while true
if showobject = 1
screen.drawobject(0,0, object)
end if

if (code = 2) 'up button
showobject = 0
end if
end while
Kinetics Screensavers
0 Kudos
RokuMarkn
Level 7

Re: Delete DrawObject

Generally with roScreen, when you want to change anything on the screen, you redraw the entire screen. So to "delete" an object, you just redraw the screen without drawing that object.

--Mark
0 Kudos