Table of Contents
The <component> element defines all aspects of the component defined in a SceneGraph XML component file. Every SceneGraph XML component file must have exactly one <component> element that contains all other XML elements in the file, which may include:
- an <interface> element that defines the interface fields of the component
- zero or more <script> elements that define the BrightScript code used by the component
- a <children> element that contains the child <node> elements (either the built-in node classes or node classes extended from them) for the component, declared in XML markup
The following attributes define a <component> XML element:
Specifies the name of the component, that allows you to create the component in your application. For example, if the name of the component is
CastMemberInfo, you could create instances of the component declaratively in a child node element of a component <children> element (
<CastMemberInfo/>), or using BrightScript in a <script> element (
name attribute is case-sensitive. You cannot successfully create or declare a component unless the component name exactly matches the
name attribute, including case. Also be aware that two components with the exact same name in the same application
components directory will have undefined and generally undesirable results if you attempt to create a component object with that name in the application.
Specifies the name of the built-in or extended SceneGraph scene or node class whose functionality is extended by this component. For example,
extends="Group" specifies the component has all of the functionality of the Group node class (it can have child nodes, has translation/scale/rotation fields, and so forth).
|initialFocus||optional||Specifies the ID of a node declared in the XML file to have the initial remote control focus when the component is instantiated.|
|version||optional||Specifies the version of the SceneGraph API. The default is 1.0 if not specified.|
The following <component> element defines a component named
GridPanelExample, that contains <interface>, <script>, and <children> elements.
<component name = "GridPanelExample" extends = "GridPanel" initialFocus = "examplePosterGrid" >
<field id = "gridcontenturi" type = "uri" onChange = "readpostergrid" />
<script type = "text/brightscript" >
m.top.panelSize = "full"
m.top.isFullScreen = true
m.top.leftPosition = 130
m.top.focusable = true
m.top.hasNextPanel = false
m.top.createNextPanelOnItemFocus = false
m.top.grid = m.top.findNode("examplePosterGrid")
m.readPosterGridTask = createObject("roSGNode", "ContentReader")
m.readPosterGridTask.contenturi = m.top.gridcontenturi
m.readPosterGridTask.control = "RUN"
m.top.grid.content = m.readPosterGridTask.content
id = "examplePosterGrid"
basePosterSize = "[ 512, 288 ]"
caption1NumLines = "1"
numColumns = "2"
numRows = "2"
itemSpacing = "[ 20, 20 ]" />