ToggleButton

From MegaZine3
Jump to: navigation, search
ASUL Component
Tag name togglebutton
Extends Box

A basic toggle button, based on two Buttons. The state is automatically switched when clicked.

Contents

[edit] Attributes

This component does not define any attributes.

[edit] Child nodes

Both child nodes are required, else this will behave like a normal button.

[edit] $btn_normal$

The button for the normal state. This must be a Button.

[edit] $btn_toggled$

The button for the toggled state. This must be a Button.

[edit] Example

<togglebutton anchors="50,50,pw-50,ph-50">
    <button name="$btn_normal$" title="Normal" anchors="0,0,pw,ph" background="color(0xFF0000)">
        <box name="$up$" anchors="0,0,pw,ph" background="color(0x7f000000)"/>
        <box name="$over$" anchors="0,0,pw,ph" background="color(0x7f999999)"/>
        <box name="$down$" anchors="0,0,pw,ph" background="color(0x7f666666)"/>
    </button>
    <button name="$btn_toggled$" title="Toggled" anchors="0,0,pw,ph" background="color(0x0000FF)">
        <box name="$up$" anchors="0,0,pw,ph" background="color(0x7f000000)"/>
        <box name="$over$" anchors="0,0,pw,ph" background="color(0x7f999999)"/>
        <box name="$down$" anchors="0,0,pw,ph" background="color(0x7f666666)"/>
    </button>
</togglebutton>
Results in the following:
ASUL-related articles
Components Box · Button · ProgressBar · ScrollBar · ScrollPane · Text · ToggleButton · Window
Layouts Horizontal Flow Layout · Vertical Flow Layout
ASUL Articles ASUL Document · Editing the GUI · Layouting · ASUL scripting
Personal tools
Namespaces
Variants
Actions
Navigation
documentation
miscellaneous
Toolbox