btpoole
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2016
04:58 PM
Syntax Error While Loading Content
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.
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
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
4 REPLIES 4
joetesta
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2016
01:43 PM
Re: Syntax Error While Loading Content
I don't know why it's a syntax error but after the crash you could poke around in debugger and see what the following return, maybe some clues or enlightenment:
? m.simpleMarkupGrid
? m.simpleMarkupGrid.content
? m.simpleMarkupGrid.content.slot
PS: DAMN this POS wysiwyg interface that makes me edit every one of my posts to strip out BS markup that leaks through in the post!!!!
? m.simpleMarkupGrid
? m.simpleMarkupGrid.content
? m.simpleMarkupGrid.content.slot
PS: DAMN this POS wysiwyg interface that makes me edit every one of my posts to strip out BS markup that leaks through in the post!!!!
aspiring
btpoole
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2016
01:49 PM
Re: Syntax Error While Loading Content
You have that problem also, thought it was just me. As for syntax error, no clue. I deleted out several lines, retyped and error went away, for now. Really odd, I can type in lines of code or copy and paste from the sdk examples and get errors, take them out and do the exact same thing and no errors. I do mean the exact same thing. Bet I have cut and re input lines a hundred times.
Thanks again for looking at it.
Thanks again for looking at it.
EnTerr
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2016
06:14 PM
Re: Syntax Error While Loading Content
@joetesta has it right -
the problem was in somewhere in the right side. Notice a most unusual diagnostic "Syntax Error. (runtime error &h02)". There is no such thing as a "runtime syntax error", since syntax errors belong to compilation which happened before starting the code. Rather this is execution error, more of a "befuddled error". Here is quick&dirty reproduction:
And, i am joining you two in wishing to "flour" this POS wysiwyg editor that descended upon us with the "snow blindness" update - cleaning after said editor is a constant battle for me, almost every message!
the problem was in somewhere in the right side. Notice a most unusual diagnostic "Syntax Error. (runtime error &h02)". There is no such thing as a "runtime syntax error", since syntax errors belong to compilation which happened before starting the code. Rather this is execution error, more of a "befuddled error". Here is quick&dirty reproduction:
BrightScript Debugger> m.a = 7
BrightScript Debugger> ? m.a.b
Syntax Error. (runtime error &h02) in $LIVECOMPILE(33)
And, i am joining you two in wishing to "flour" this POS wysiwyg editor that descended upon us with the "snow blindness" update - cleaning after said editor is a constant battle for me, almost every message!
btpoole
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2016
06:21 PM
Re: Syntax Error While Loading Content
Thanks EnTerr for more info on it. I have since deleted out code from Task and from the scene and re enter with no errors. Not sure what the deal was or still is but it's running thru now. What's really confusing is that both the task and the scene shows the field to be present and the task was populated when ran.