The List
component is a container component that allows users to display and interact with a scrollable list of items.
The setContent
is a method of the List
component that sets the content
property of the List
to the given content
node
. The content
node
must be a subnode of RowContent
, which has the following structure:
<component
name='ml_RowContent'
extends='mc_Node'>
<interface>
<field
id='title'type='string' />
<field
id='settings'type='node' />
<field
id='isHidden'type='boolean'
value='false' />
<field
id='isFocusEnabled'type='boolean'
value='true' />
</interface>
</component>
The title
field contains the title of the row, the settings
field contains a node
with settings for the row, the isHidden
field is a boolean value indicating whether the row is currently hidden, and the isFocusEnabled
field is a boolean value indicating whether the row can receive focus.
This will set the content
property of myList
to myRowContentNode
.
When calling functions on the List
component, you can use the @
symbol to indicate that the function is being called on a List
instance, as in the following example:
[email protected](myContentNode)
The List
component uses the RowSettings
object to determine how to render the items in the list. The RowSettings
object has the following fields:
component
: a string that specifies the component to be used for rendering the rowstyle
: a string that specifies the style to be used for rendering the rowtitle
: a string that specifies the title of the rowtitleStyle
: a string that specifies the style to be used for rendering the title of the rowfocusSettings
: anode
that contains the focus settings for the rowheaderSettings
: anode
that contains the header settings for the rowcellSettings
: anode
that contains the cell settings for the row
The List
component uses these settings to determine how to render each row in the list. The child items of the List
are children of the RowSettings
object, and the ml_RowContent
object is a subnode of mc_Node
, which is a special, more efficient node that allows for batching of changes.
Note that the List
component does not automatically update itself when the content
of the list changes. Instead, changes to the content
must be communicated to the List
using the mc_Node
APIs, such as notifyUpdate()
. In order to update individual child renderers, the child items must have a version
field that is incremented when the child is updated.
Here is an example of how to use the RowSettings
object to specify the rendering settings for a row in the List
:
myRowSettings = {
component: "GridRow",
style: "default",
title: "My Row Title",
titleStyle: "default",
focusSettings: {...},
headerSettings: {...},
cellSettings: {...}
}
myRowContent = {
title: "My Row",
settings: myRowSettings,
isHidden: false,
isFocusEnabled: true
}
[email protected](myRowContent)
This code sets the content
of the List
to a RowContent
node with the specified RowSettings
object, which will be used to determine how the row is rendered in the list.
content
: anode
that contains the items to be displayed in the listdelegate
: anode
that contains the delegate functions to be used by the liststate
: the current state of the list (default is "none")width
: the width of the list in pixels (default is 1920)height
: the height of the list in pixels (default is 1080)isHidden
: a boolean value indicating whether the list is currently hidden (default is false)_updateNow
: a boolean value indicating whether the list should be updated immediately (default is false)_forceReloadListWhenPressingOption
: a boolean value indicating whether the list should be reloaded when the "option" button is pressed (default is false)isScrolling
: a boolean value indicating whether the list is currently scrolling (default is false)screenOffset
: the number of pixels that the list has been scrolled (default is 0)scrollDirection
: the direction in which the list is currently scrolling (default is 0)focusedRowIndex
: the index of the currently focused row in the list (default is 0)focusedSubRowIndex
: the index of the currently focused sub-row in the list (default is 0)focusedCellIndex
: the index of the currently focused cell in the list (default is 0)focusedfraction
: the fraction of the distance between the current and next focused cells (default is 0.0)focusIndicatorManager
: anode
that manages the focus indicator for the listnextFocusIndex
: an array containing the indices of the next focused item in the listscreenPos
: the current position of the list on the screennextScreenPos
: the next position of the list on the screen
Creates a new instance of the List class.
Initializes the list by creating the necessary views and managers.
Sets the content of the list to the specified value.
Argument name | Type | Description |
---|---|---|
content |
mc.types.node |
The new content for the list. This must be of type ListContent. |
Synchronizes the content of the list.
Forces an update of the list.
Forces an update of the list layout.
Argument name | Type | Default value | Description |
---|---|---|---|
fullUpdate |
Boolean |
false | Whether to perform a full update or not. |
Updates the list when the content changes.
onIsHiddenChange()
Updates the list when the isHidden property changes.
Moves the focus to the end of the list in the specified direction.
Argument name | Type | Default value | Description |
---|---|---|---|
direction |
Integer |
-1 | The direction to move the focus. A value of -1 moves the focus to the start of the list, while a value of 1 moves the focus to the end of the list. |
animated |
Boolean |
false | Whether to animate the movement of the focus. |
Moves the focus to the specified row and item index.
Argument name | Type | Description |
---|---|---|
rowIndex |
Integer |
The index of |
Retrieves the row at the specified index.
Argument name | Type | Description |
---|---|---|
index |
Integer |
The index of the row to retrieve. |
Retrieves the item at the specified row and index.
Argument name | Type | Description |
---|---|---|
rowIndex |
Integer |
The index of the row that the item is in. |
index |
Integer |
The index of the item within the row. |
The item at the specified row and index, or invalid
if the index is out of bounds or there is no content. The returned value is of type dynamic
.
Moves the focus to the specified row.
Argument name | Type | Default value | Description |
---|---|---|---|
index |
Integer |
None | The index of the row to move the focus to. |
animated |
Boolean |
None | Whether to animate the movement of the focus. |
animSpeedIndex |
Integer |
0 | The index of the animation speed to use. |
Moves the focus to the specified row and item index.
Argument name | Type | Default value | Description |
---|---|---|---|
rowIndex |
Integer |
None | The index of the row to move the focus to. |
index |
Integer |
None | The index of the item within the row to move the focus to. |
animated |
Boolean |
None | Whether to animate the movement of the focus. |
animSpeedIndex |
Integer |
0 | The index of the animation speed to use. |
Moves the focus to the specified sub-row index.
Argument name | Type | Default value | Description |
---|---|---|---|
index |
Integer |
None | The index of the sub-row to move the focus to. |
animated |
Boolean |
None | Whether to animate the movement of the focus. |
animSpeedIndex |
Integer |
0 | The index of the animation speed to use. |
setFocusIndex |
Boolean |
false | Whether to set the focus index to the specified sub-row index. |
useGridHack |
Boolean |
false | Whether to use the "grid hack" when moving the focus. |
Void
Enables or disables updates for the list.
Argument name | Type | Description |
---|---|---|
enabled |
Boolean |
Whether to enable updates for the list. |
Void
Retrieves the row renderer at the specified index.
Argument name | Type | Description |
---|---|---|
index |
Integer |
The index of the row renderer to retrieve. |
The row renderer at the specified index, or invalid
if the index is out of bounds. The returned value is of type dynamic
.
Retrieves the cell renderer at the specified row and cell index.
Argument name | Type | Description |
---|---|---|
rowIndex |
Integer |
The index of the row that the cell renderer is in. |
cellIndex |
Integer |
The index of the cell renderer within the row. |
The cell renderer at the specified row and cell index, or invalid
if the index is out of bounds. The returned value is of type dynamic
.
Retrieves the focused row renderer.
The focused row renderer, or invalid
if there is no focused row renderer. The returned value is of type dynamic
.
Retrieves the focused cell renderer.
The focused cell renderer, or invalid
if there is no focused cell renderer. The returned value is of type dynamic
.
Retrieves the content of the focused row.
The content of the focused row, or invalid
if there is no focused row or no content. The returned value is of type dynamic
.
Retrieves the content of the focused cell.
The content of the focused cell, or invalid
if there is no focused cell or no content. The returned value is of type dynamic
.