Images not loaded, When I update a content in PosterGrid

Viewed 111

I used Custom SGDex View in MainScene and Using the below code, I have opened the dialog box inside PostGrid. It's Extends With the Group node.

sub init()
   m.postergrid = m.top.findNode("PosterGrid")
   m.top.GlobleURL = GetAuthData("URL")
   m.readPosterGridTask = createObject("roSGNode", "ContentReader")
   m.readPosterGridTask.contenturi = "http://" + m.top.GlobleURL + "/api/DefaultAPI/?file=GoForwards.xml" 
   m.readPosterGridTask.observeField("content", "showpostergrid")
   m.readPosterGridTask.control = "RUN"
end sub 

function OpenDialog()
   m.dlg = createObject("roSGNode", "Dialog")
   m.port = createObject("roMessagePort")
   m.dlg.observeField("wasClosed", m.port)
   m.dlg.title = "Menu"
   m.dlg.buttons = ["ReverseOrder"]
   m.dlg.observeField("buttonSelected", "onVerifyOptions")
   m.dlg.getScene().dialog = m.dlg 
end function

function onVerifyOptions()
 if m.dlg.getScene().dialog.buttonSelected = 0 then
  ?"onVerifyOption() :: 0 index"
  m.readPosterGridTask.contenturi = "http://" + m.top.GlobleURL + "/api/DefaultAPI/file=ReverseOrder.xml"
  m.readPosterGridTask.observeField("content", "showpostergrid")
  m.readPosterGridTask.control = "RUN"
  m.dlg.getScene().dialog.close = true
 end if
 return true
end function

sub showpostergrid()
  m.postergrid.content = m.readPosterGridTask.content
end sub

Inside a Dialog Box click to 0 indexes. I update the content like the above code. But, Here Image not loaded. After, I refresh Content Render. But, When Roku Set-top Box is going sleep mode. After I clicked Ok, It starts to load. I don't know why this is happening. the same thing, I check inside a scene node. It's working fine. But, Inside a Group node, I found this issue. Does anyone know about this issue?

At first, I thought this would be the issue of OS. I created another Demo application for this. it works well. But Here dialog box open like below.

sub showdialog()
   optiondialog = CreateObject("roSGNode", "Dialog")
   optiondialog.title = "Menu"
   optiondialog.buttons = ["ReverseOrder"] 
   m.top.dialog = optiondialog
   m.top.dialog.observeField("buttonSelected", "onVerifyOptions")
   m.top.dialog.setFocus(true)
end sub

I don't understand clearly if this is the issue with getScene() or I am making a mistake in updating the content. Is there any other way to Update RSG Component Content?

1 Answers

I think instead of
m.dlg.getScene().dialog = m.dlg

you should use:
m.top.dialog = m.errorDialog

and similarly, replace
m.dlg.getScene().dialog.close = true

with
m.top.dialog.close = true

and you probably need to reset your focus at the same point.

Related