I have the following code which when remote button id=9 is pressed, a box (setlayer 10) is drawn on a section of the canvas and the first array element (setlayer 11) is displayed on part of the screen. As the remote button is pressed to scroll down id=3, the layers are to clear and then redraw changing the location of the box (setlayer 10) and advancing in the index of the array to display the next element. All this works with exception that the layers do not clear. When remote is pressed, initial box location and initial text location disappears very briefly and the new box is drawn in the correct location but the initial box is also still visible, same for the text, the new text is placed on top of the initial text. I can press the button for id=8 and all the desired layers clear as expected. I am using the same type of code in another section of the channel and it it works. Not sure why the layers are not clearing.
if id=9
m.yhilite=77 'start location of box
pTxt=265 'location of text
programindex=0
displaylist=[] 'text
descripbox=[] 'box
cid=m.guide[index]
xmlxfer=CreateObject("roUrlTransfer")
xmlport=CreateObject("roMessagePort")
xmlxfer.SetMessagePort(xmlport)
xmlxfer.SetUrl(cid) 'CALL XML URL
response=xmlxfer.GetToFile("tmp:/status.temp1") 'STORE TO FILE
readxml=ReadAsciiFile("tmp:/status.temp1") 'READ FILE
xml = CreateObject("roXMLElement")
IF xml.Parse(readxml) 'SETUP RETURN FOR PARSE
?"PARSED. . ."
descripbox.Push({ 'initial box
url: "pkg:/images/hilitebox.png"
TargetRect: {x: 350, y: m.yhilite, w: 300, h: 50}
})
displaylist.Push({ 'initial text
Text: xml.programme[programindex].desc.gettext()
TextAttrs: {color: "F9F5FA", VAlign: "middle", font: "small"}
TargetRect: {x:345, y:300, w: 300, h: 70}
})
m.canvas.setlayer(10, descripbox) 'set initial box layer
m.canvas.setlayer(11,displaylist) 'set initial text layer
while id <> 8 'LOOP UNTIL CANCEL IS CALLED
msg = wait(0, m.port)
if (msg.isRemoteKeyPressed())
id = msg.GetIndex()
if msg <> invalid 'IF PORT MESSAGE NOT INVALID
?"REMOTE BUTTON PRESSED. . ."id
if id=3 'SCROLL DOWN
?"REMOTE LOCATION. . ."programindex
m.canvas.clearlayer(10) 'clear the layer for box reposition
m.canvas.clearlayer(11) 'clear the layer for new text
m.yhilite= m.yhilite + 50 'move box down
programindex=programindex + 1 'MOVE FORWARD 1
programinfo={
desc: xml.programme[index].desc.gettext()
}
displaylist.Push({
Text: xml.programme[programindex].desc.gettext()
TextAttrs: {color: m.guidecolor, HAlign: m.channelalign, Direction: m.channeldirection, font: "small"}
TargetRect: {x:345, y:300, w: 300, h: 100}
})
descripbox.Push({
url: "pkg:/images/hilitebox.png"
TargetRect: {x: 350, y: m.yhilite, w: 300, h: 60}
})
m.canvas.setlayer(10, descripbox) 'set layer for new box location
m.canvas.setlayer(11,displaylist) 'set layer for new text
m.canvas.show() 'update screen
elseif id=8 'cancel out of loop
m.canvas.clearlayer(10)
m.canvas.clearlayer(11)
exit while
end if
end if
end if
end while
else
?"DIDNT PARSE"
endif