ScrollPane

From MegaZine3
(Redirected from Scrollpane)
Jump to: navigation, search
ASUL Component
Tag name scrollpane
Extends Box

The scroll pane is a container that can be used to scroll its content when the content's size exceeds the size of the scroll pane itself.

Contents

[edit] Attributes

mousemode

This determines how the mouse can be used to drag the contents of the scroll pane (i.e. scroll the contents). Per default, direct mouse interaction is disabled, and scroll bars (or the API) have to be used.

mousewheel

This determines whether the mouse wheel should be used to scroll inside the scroll pane. When set to x, turning the mouse wheel with the cursor hovering the scroll pane will scroll along the x axis, when set to y along the y axis.

mousewheelstep

The step size by which to scroll when turning the mouse wheel (and scrollpane@mousewheel is set to either x or y.

[edit] Child nodes

$scroll_x$

A scroll bar that is used for horizontal scrolling.

$scroll_y$

A scroll bar that is used for vertical scrolling.

$viewport$

The actual content of the scroll pane that should be scrolled if too big.

[edit] Example

[edit] Using mouse_drag and scrollbars

<scrollpane anchors="0,0,pw-25,ph-25" mousemode="mouse_drag" clipchildren="false">
    <box name="$viewport$" resize="true">
        <box width="2560" height="1600"
             background="image(http://www.megazine3.de/demo/megazine/data/zoom2.jpg)"/>
    </box>
    <scrollbar name="$scroll_x$" anchors="0,ph,pw,ph+25"
               background="gradient(linear,0x000099,0x6666CC)">
        <button name="$btn_reduce$" anchors="0,0,25,ph">
            <box name="$up$" anchors="2,2,pw-2,ph-2" background="color(0x9999DD)"/>
            <box name="$over$" anchors="2,2,pw-2,ph-2" background="color(0xAAAAEE)"/>
            <box name="$down$" anchors="4,4,pw-4,ph-4" background="color(0x8888CC)"/>
        </button>
        <button name="$btn_increase$" anchors="pw-25,0,pw,ph">
            <box name="$up$" anchors="2,2,pw-2,ph-2" background="color(0x9999DD)"/>
                <box name="$over$" anchors="2,2,pw-2,ph-2" background="color(0xAAAAEE)"/>
            <box name="$down$" anchors="4,4,pw-4,ph-4" background="color(0x8888CC)"/>
        </button>
        <button name="$scroll_handle$" width="25" height="25">
            <box name="$up$" anchors="4,4,pw-4,ph-4" background="color(0xDD9999)"/>
            <box name="$over$" anchors="4,4,pw-4,ph-4" background="color(0xEEAAAA)"/>
            <box name="$down$" anchors="6,6,pw-6,ph-6" background="color(0xCC8888)"/>
        </button>
    </scrollbar>
    <scrollbar name="$scroll_y$" anchors="pw,0,pw+25,ph" orientation="vertical"
               background="gradient(linear-vertical,0x000099,0x6666CC)">
        <button name="$btn_reduce$" anchors="0,0,25,pw">
            <box name="$up$" anchors="2,2,pw-2,ph-2" background="color(0x9999DD)"/>
            <box name="$over$" anchors="2,2,pw-2,ph-2" background="color(0xAAAAEE)"/>
            <box name="$down$" anchors="4,4,pw-4,ph-4" background="color(0x8888CC)"/>
        </button>
        <button name="$btn_increase$" anchors="pw-25,ph-25,pw,ph">
            <box name="$up$" anchors="2,2,pw-2,ph-2" background="color(0x9999DD)"/>
                <box name="$over$" anchors="2,2,pw-2,ph-2" background="color(0xAAAAEE)"/>
            <box name="$down$" anchors="4,4,pw-4,ph-4" background="color(0x8888CC)"/>
        </button>
        <button name="$scroll_handle$" width="25" height="25">
            <box name="$up$" anchors="4,4,pw-4,ph-4" background="color(0xDD9999)"/>
            <box name="$over$" anchors="4,4,pw-4,ph-4" background="color(0xEEAAAA)"/>
            <box name="$down$" anchors="6,6,pw-6,ph-6" background="color(0xCC8888)"/>
        </button>
    </scrollbar>
    <box anchors="pw,ph,pw+25,ph+25" background="color(0x6666CC)" mouseenabled="true"/>
</scrollpane>
Results in the following:

[edit] Using mouse_move

<scrollpane anchors="0,0,pw,ph" mousemode="mouse_move">
    <box name="$viewport$" resize="true">
        <box width="2560" height="1600"
             background="image(http://www.megazine3.de/demo/megazine/data/zoom2.jpg)"/>
    </box>
</scrollpane>
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