Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 
scaper12123
Level 7

screengraph node issues?

EDIT: NEVER MIND! I figured out my problem. I needed to create a reference directly to the node. I wrote n=m.top.findNode("buttonPairLeft") and that let me add in the values. So that's good Smiley Very Happy

EDIT: update, I was told my issue is that I hadn't added any buttons, but given the formatting that i've opted to use I don't know how to add the buttons. I'm not sure it can be done directly while writing the nodes (using a buttons field), as the file is telling me there are errors. I attempted to set the values with the associative array format (i.e. layoutgroup.MainScreenLayoutGroup.innerGroup.buttonPairLeft.buttons = ["test1", "test2"]) but that didn't work either. So... what am I supposed to do here?

          <ButtonGroup id="buttonPairLeft"
minWidth ="100"
buttonHeight="10"
buttons="[test1, test2]"
/>

<ButtonGroup id="buttonPairRight"
minWidth="100"
buttonHeight="10"
buttons="[test3, test4]"
/>


(I wonder if anybody is recognizing me at this point)

I am currently writing code for a screen graph application in which I have 5 buttons arranged into a configuration where four buttons are in a grid-like layout below one wide button. I've managed to get a start on the configuration but, when I launch the app, it only shows me the one wide button. I'm not sure what I've missed here. Can anybody help, please?

this is the code I have:
[spoiler=code:gfvfhrgw]
<?xml version="1.0" encoding="utf-8"?>
<component name="MainScreen" extends="Scene">

<script type="text/brightscript" uri="pkg:/components/MainScreen.brs" />

<children>
<Group id ="MainScreenGroup">

<LayoutGroup id="MainScreenLayoutGroup"
layoutDirection ="vert"
vertAlignment="center"
itemSpacings="[10]"
addItemSpacingAfterChild="true" >

<Button id="streamButton"
text="Watch live service"
minWidth="1000"
height ="200"
showFocusFootprint="true"
/>

<LayoutGroup id="innerGroup"
layoutDirection ="horiz"
itemSpacings="10"
addItemSpacingAfterChild="true" >

<ButtonGroup id="buttonPairLeft"
minWidth ="100"
buttonHeight="10"
/>

<ButtonGroup id="buttonPairRight"
minWidth ="100"
buttonHeight="10"
/>

</LayoutGroup>

</LayoutGroup>

</Group>

</children>

</component>


MainScreen.brs:
sub init()
'we can add a background here
'm.top.backgroundURI= some image url
m.top.setFocus(true)

layoutgroup = m.top.findNode("MainScreenGroup")

devInfo = createObject("roDeviceInfo")
UIResolution = devInfo.getUIResolution()

lgr = layoutgroup.boundingRect()
lglr = layoutgroup.localBoundingRect()

x = -lgr.x + (UIResolution.width - lglr.width) / 2
y = -lgr.y + (UIResolution.height - lglr.height) / 2

layoutgroup.translation = [x, y]
end sub
[/spoiler:gfvfhrgw]
I AM THE ARCHMAGE... who is also rather new to Brightscript so forgive me for seeming inept at times.
0 Kudos
4 Replies
TheEndless
Level 7

Re: screengraph node issues?

I don't see any code that adds buttons to the two ButtonGroups. Did you omit that from the post, or are you failing to add content? If the latter, that would be the issue.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
scaper12123
Level 7

Re: screengraph node issues?

"TheEndless" wrote:
I don't see any code that adds buttons to the two ButtonGroups. Did you omit that from the post, or are you failing to add content? If the latter, that would be the issue.


Oh, that makes sense. :c

I'm trying to fix that issue now but when I try to write the button field for the buttonPairRight child, it tells me that there's problems with the file.

          <ButtonGroup id="buttonPairLeft"
minWidth ="100"
buttonHeight="10"
buttons="[test1, test2]"
/>

<ButtonGroup id="buttonPairRight"
minWidth="100"
buttonHeight="10"
buttons="[test3, test4]"
/>
I AM THE ARCHMAGE... who is also rather new to Brightscript so forgive me for seeming inept at times.
0 Kudos
TheEndless
Level 7

Re: screengraph node issues?

"buttons" is an array of strings, so you'd need to play around with single and double-quote if you want to define it in XML. Try this:
<ButtonGroup id="buttonPairRight"
minWidth="100"
buttonHeight="10"
buttons='["test3", "test4"]'
/>


Alternatively, you could set it in your init() instead:
buttonGroup = m.top.findNode("buttonPairRight")
buttonGroup.buttons = ["test3", "test4"]
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
EnTerr
Level 8

Re: screengraph node issues?

"TheEndless" wrote:
"buttons" is an array of strings, so you'd need to play around with single and double-quote if you want to define it in XML. Try this:

And one more way:

buttons="[&quot;test3&quot;, &quot;test4&quot;]"

Behold, the joy of programming in xml! It's like Vogon poetry
0 Kudos