Ui XML Reference\State
Define a UI state. Often used with bind
properties. The value can be changed based on events or lua scripts.
Example Usage
<Frame layout="flex" flexDirection="column">
<!-- 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:frameImage="'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'" />
</Frame>
Example lua script to modify a state's value:
local state = DCEI.GetFrameState(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:
Related Trigger Function(s):
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.GetFrameState(xml)
state.enable = "true"
Related Trigger Function(s):
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.GetFrameState(xml)
state.size = "500"
Related Trigger Function(s):
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.GetFrameState(xml)
state.text = "Still Placeholder Text"
Related Trigger Function(s):
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.GetFrameState(xml)
state.enable = "true"