Forum Discussion

PTKDev's avatar
PTKDev
Visitor
11 years ago

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
'=============================================

2 Replies

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