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: 
PTKDev
Visitor

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

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
Visitor

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
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.