Ui XML State - BLKTower/TestWiki GitHub Wiki

Table of Contents

Define a UI state. Often used with bind properties. The value can be changed based on events or lua scripts.

Example Usage

<VStack xmlns:bind="https://platform.wildsky.dev/xml/ui/bind">
    <!-- Declare initial state values. -->
    <State name="red" booleanValue="false" />
    <!-- Show different background images depending on the state value and flip state value when clicked. -->
    <Button bind:backgroundImage="'btn_' .. (state.red and 'red' or 'blue')" bind:onClick="state.red = not state.red">
        <Text text="switch color" />
    </Button>
    <Text bind:text="state.red and 'red' or 'blue'" />
</VStack>

Example lua script to modify a state's value:

local state = DCEI.GetXmlUiState(text_ui)

-- updates any lua state conditions defined in the XML element that use the `mode` state
state.mode = "default"

This XML produces the following UI: image

Related Trigger Function(s):

Define a UI state

This frame cannot have child frame.

This frame doesn't support common attributes.

name

Value type: string

Description

The name of the UI state. Used to identify the state when binding properties or updated the value.

Example Usage

<State name="enable" booleanValue="false" />

Lua script to modify the state's value:

local state = DCEI.GetXmlUiState(xml)
state.enable = "true"

Related Trigger Function(s):

  • None.

numberValue

Value type: number

Description

The number value of the UI state.

Example Usage

<State name="size" numberValue="100" />

Lua script to modify the state's value:

local state = DCEI.GetXmlUiState(xml)
state.size = "500"

Related Trigger Function(s):

  • None.

stringValue

Value type: string

Description

The string value of the UI state.

Example Usage

<State name="text" stringValue="Placeholder Text" />

Lua script to modify the state's value:

local state = DCEI.GetXmlUiState(xml)
state.text = "Still Placeholder Text"

Related Trigger Function(s):

  • None.

booleanValue

Value type: boolean

Description

The boolean value of the UI state.

Example Usage

<State name="enable" booleanValue="false" />

Lua script to modify the state's value:

local state = DCEI.GetXmlUiState(xml)
state.enable = "true"

Related Trigger Function(s):

  • None.

⚠️ **GitHub.com Fallback** ⚠️