EDIT: Never mind, I just had forgotten quotes and it was interfearing with the onKeyEvent prompt.
EDIT: I was told that I needed to implement onKeyEvent() but, when I did, I didn't get the expected result. Am I missing something here?I have a particular circumstance with a set of buttons I've made, where the arrangement is made using a layout group with a button node and two separate buttonGroup nodes. Upon running the code, none of the buttons can be selected and I am not sure how to make it so a button can be selected. (It may also be worth noting that only one button appears to be made in each node group, as far as I can tell.) Note that I am aware of the focusButton parameter in buttonGroups, but the button I want to initially have selected is the one created by the button node rather than either of the buttonGroups.
Also note that I am aware that, in order to make actual use of the buttons, I have to create a listening object which executes a function upon the user selecting any of the buttons. I am reasonably confident I will be able to figure that part out. It's the actual functionality of the menu I've created that I'm having difficulty with.
This is the code I've written. Any help would be appreciated.
[spoiler=code:3sq2vlnh]
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
<?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
layoutDirection ="vert"
vertAlignment="center"
itemSpacings="[10]"
addItemSpacingAfterChild="true" >
<Button
text="Watch live service"
minWidth="1010"
height ="200"
showFocusFootprint="true"
/>
<LayoutGroup
layoutDirection ="horiz"
itemSpacings="10"
addItemSpacingAfterChild="true" >
<ButtonGroup id="buttonPairLeft"
rightJustify ="false"
minWidth ="500"
buttonHeight ="150"
buttons='["test1", "test2"]'
/>
<ButtonGroup id="buttonPairRight"
rightJustify ="false"
minWidth ="500"
buttonHeight ="150"
buttons='["test3", "test4"]'
/>
</LayoutGroup>
</LayoutGroup>
</Group>
</children>
</component>
[/spoiler:3sq2vlnh]
I AM THE ARCHMAGE... who is also rather new to Brightscript so forgive me for seeming inept at times.