Here's a more detailed view of the problem. below is the sub that runs for find the child and replacechild. This is the replace for the first grid I have. The second grid is called PickList. I don't have the code for it here since when it runs after MyGrid (refreshContent sub) the child is gone, so it disappears from screen.
sub refreshContent()
?"in refreshContent"
m.MyGrid=m.top.findNode("MyGrid")
for i = 0 to m.top.getChildCount()-1
child = m.top.getChild(i)
?"CHILD "child.id" "i
if child.id = "MyGrid"
?"MyGrid INDEX "i
exit for
end if
end for
m.MyGrid.content = m.global.posterx.show
m.top.replaceChild(m.MyGrid ,i)
?"REPLACEMENT "m.top.replaceChild(m.MyGrid ,i)
m.programmarkupgrid.SetFocus(true)
m.programmarkupgrid.visible= true
?"RESET CONTENT DONE"
for q= 0 to m.top.getChildCount() - 1
?"CHILD "m.top.getChild(q).id
end for
Ok, I am not creating a new child, but setting the content to new content that was downloaded.
Below is the debug from the initial for loop thru the children. Notice it finds MyGrid at 15. Also not PickList at 14.
in refreshContent
in setColumnWidth--
CHILD 0
CHILD blank 1
CHILD UpdateGridContent 2
CHILD 3
CHILD background 4
CHILD TopLogo 5
CHILD instructLabel 6
CHILD Background 7
CHILD ActivationDate 8
CHILD Message 9
CHILD theMessage 10
CHILD MessageBackground 11
CHILD favoriteList 12
CHILD ImageList 13
CHILD PickList 14
CHILD MyGrid 15
MyGrid INDEX 15
REPLACEMENT true
in onFocusChanged
PROGRAM COLUMN FOCUSED 0
GRID LOCATION 2
NUMBER OF COLUMNS 20
RESET CONTENT DONE
Here is the debug widnow for the loop after the replace has taken executed. Note PickList is no longer a child and index is changed.
CHILD 0
CHILD blank 1
CHILD UpdateGridContent 2
CHILD 3
CHILD background 4
CHILD TopLogo 5
CHILD instructLabel 6
CHILD Background 7
CHILD ActivationDate 8
CHILD Message 9
CHILD theMessage 10
CHILD MessageBackground 11
CHILD favoriteList 12
CHILD ImageList 13
CHILD MyGrid 14
CHILD currenttimedate 15
CHILD gridline_top 16
CHILD liveVideo 17
CHILD Weather 18
CHILD ChannelPoster 19
CHILD BottomBar 20
CHILD ShowBar 21
CHILD HideBar 22
CHILD Hint 23
CHILD Timer 24
CHILD 25