The following code gives me a syntax error and I don't really understand why. I get a syntax error where dataItem.slot=m.simpleMarkupGrid.content.slot. I am adding
slot field in an interface. I know from the ?dataItem and ?dataItem.hasfield("slot") the field is there. I can even set the value of slot to a string "test" and it shows up. The
value of slot coming from the task is also populated. I have check it in the task and even printed it and it has value.
EDIT: I don't know if this makes a difference but maybe, I am using the task to create 2 url transfers in the same function and one content node. The first reads a json file and parses to get channel names (title) the second then reads a json file and parses to get show times (slot). As shown in the code the list and grid contents come from the same task. I don't see why this would cause a problem but I am probably wrong.
Sub init()
?"ENTER LOAD DATA. . ."
m.simpleMarkupList = m.top.findNode("SimpleMarkupList")
m.simpleMarkupGrid = m.top.findNode("SimpleMarkupGrid")
m.ContentTask = createObject("RoSGNode","ContentReader")
m.ContentTask.ObserveField("content", "setcontent")
m.ContentTask.control = "RUN"
?"TASK RAN"
m.simpleMarkupGrid.content=setgrid()
m.simpleMarkupList.ObserveField("itemFocused", "onFocusChanged")
end sub
sub setcontent()
?"IN SETCONTENT"
m.simpleMarkupList.content=m.ContentTask.content
m.simpleMarkupList.SetFocus(true)
m.simpleMarkupGrid.content=m.ContentTask.content
Function setgrid()
?"IN SETGRID"
data = CreateObject("roSGNode", "ContentNode")
dataItem= data.CreateChild("SimpleGridItemData")
?dataItem
?dataItem.hasfield("slot")
dataItem.slot= m.simpleMarkupGrid.content.slot
return data
end function
The debugger shows:
BrightScript Debugger> ENTER LOAD DATA. . .
TASK RAN
IN SETGRID
<Component: roSGNode> =
{
metadata: <Component: roContentMetadata>
change: <Component: roAssociativeArray>
focusable: false
focusedChild: <Component: roInvalid>
id:
slot:
}
true
Current Function:
022: Function setgrid()
023: ?"IN SETGRID"
024: data = CreateObject("roSGNode", "ContentNode")
025: dataItem= data.CreateChild("SimpleGridItemData")
026: ?dataItem
027: ?dataItem.hasfield("slot")
028:* dataItem.slot= m.simpleMarkupGrid.content.slot
029: return data
030: end function
Syntax Error. (runtime error &h02) in pkg:/components/entry.brs(28)
028: dataItem.slot= m.simpleMarkupGrid.content.slot
Backtrace:
#1 Function setgrid() As Dynamic
file/line: pkg:/components/entry.brs(28)
#0 Function init() As Void
file/line: pkg:/components/entry.brs(10)
Local Variables:
global rotINTERFACE:ifGlobal
m roAssociativeArray refcnt=4 count:5
data bsc:roSGNode refcnt=1
dataitem bsc:roSGNode refcnt=1