ui.ComponentCollection¶
Overview¶
ui.Component -> ui.ComponentCollection
Base type common to all user interface layout components.
The following layout component types are available:
- Layer - Simple component that allows arbitrary positioning/sizing of child components
- Panel - Automatically positions/resizes components along the panel's direction (either horizontal or vertical), taking into account total component sizes across that dimension.
- Grid - Organises components in a grid. Supports using either fixed-size grid cells, resulting in dynamic rows and columns, or a fixed number of rows and columns, which results in dynamic grid cell sizes
- Paged Layer - A tabbed version of the layer component, and containing functionality for creating tab headers.
- Paged Carousel - A variant of
Paged Layerthat has built-in functionality for switching between pages, and supports displaying the contents of multiple pages at a time as part of a horizontal carousel. - Group Box - Similar to
Layerin that it allows arbitrary positioning/sizing of child components, but additionally encloses them in a box with an optional header label.
Methods¶
IterateStaticComponents/IterateDynamicComponents¶
function ComponentCollection:IterateStaticComponents(callback : function (component : ui.Component, visible : Bool) -> Bool)
function ComponentCollection:IterateDynamicComponents(callback : function (component : ui.Component, visible : Bool) -> Bool)
Iterates over statically defined components contained in this collection, executing the provided callback once for each component, optionally stopping based on the callback's return value.
| Parameter | Type | Description |
|---|---|---|
| callback | function (component : ui.Component, visible : Bool) -> Bool | Callback to execute for each component, receiving the component and its visibility status. If it returns true, iteration will stop |
Example
GetChild¶
function ComponentCollection:GetChild(staticID : Int) -> Component<T>?
function ComponentCollection:GetChild(categoryID : Int, dynamicID : Int) -> Component<T>?
Attempts to retrieve the static or dynamic child component corresponding to the provided IDs, returning nil if missing.
| Parameter | Type | Description |
|---|---|---|
| staticID | Int | Value used to identify a static component. |
| categoryID | Int | Value used to identify the category associated with a component. |
| dynamicID | Int | Value used to identify the in-category ID associated with a component. |
| Returns | Description |
|---|---|
| Component |
The existing component if found, or nil if missing |
Example
Delete¶
Attempts to delete the dynamic child component corresponding to the provided IDs, returning true if successful.
| Parameter | Type | Description |
|---|---|---|
| categoryID | Int | Value used to identify the category associated with a component. |
| dynamicID | Int | Value used to identify the in-category ID associated with a component. |
| Returns | Description |
|---|---|
| Bool | Indicates whether or not a component was deleted. |
Example
DeleteAll¶
Deletes all dynamically created child components contained in the current collection.
Info
Individual components can be deleted by using Component:Destroy or ComponentCollection:Delete instead
SetScrollPos¶
Sets the origin of this component's scroll region, if it supports scrolling.
| Parameter | Type | Description |
|---|---|---|
| x | Int | Horizontal origin for this component's scroll region. |
| y | Int | Vertical origin for this component's scroll region. |
SetScrollSize¶
Sets the size of this component's scroll region, if it supports scrolling.
| Parameter | Type | Description |
|---|---|---|
| width | Int | Target width for this component's scroll region. |
| height | Int | Target height for this component's scroll region. |
Properties¶
| Name | Type | Description |
|---|---|---|
| scrollable | bool | (Read-only) Indicates whether this component can be scrolled. |
| scrollX | number | (Read-only) Current horizontal origin for this component's scroll region. |
| scrollY | number | (Read-only) Current vertical origin for this component's scroll region. |
| scrollWidth | number | (Read-only) Width of this component's scroll region. |
| scrollHeight | number | (Read-only) Height of this component's scroll region. |