Table of Contents

splitpanel

`splitpanel()` creates a two-pane container. Each pane can hold one child component.

Constructor

splitpanel()

Creates a splitpanel object.

Item Description
Syntax `splitpanel()`
Arguments none
Returns splitpanel object

Example:

split = splitpanel().position(10, 10).size(480, 260);

Properties

Properties are read-only. Use methods to change GUI object state.

Property Type Description
`position_x` number Current x position.
`position_y` number Current y position.
`size_width` number Current width.
`size_height` number Current height.
`visible` boolean Current visible state.
`enabled` boolean Current enabled state.
`orientation` string Current orientation: `left_right` or `top_bottom`.
`resize_mode` string Current resize mode: `proportional`, `fixed_first`, or `fixed_second`.
`first_visible` boolean Whether the first pane is visible.
`second_visible` boolean Whether the second pane is visible.
`split_ratio` number Current proportional split ratio.
`first_size` number Current first pane size in pixels.
`second_size` number Current second pane size in pixels.
`splitter` number Current splitter size in pixels.
`first_min_size` number Minimum first pane size.
`second_min_size` number Minimum second pane size.

Common Object Methods

to_string()

Returns a display string for the object.

Item Description
Syntax `value.to_string()`
Arguments none
Returns string

Example:

text = value.to_string();

`clone()` is not supported for `splitpanel`.


Most visible GUI controls support these methods.

position(x, y)

Sets the component position in pixels.

Item Description
Syntax `component.position(x, y)`
Arguments `x`: x position; `y`: y position
Returns component object

Example:

label().position(20, 10);

size(width, height)

Sets the component size in pixels. Width and height are clamped to at least `1`.

Some container objects, such as `panel()` and `group()`, use `size(-1, -1)` as a special fit-parent mode.

Item Description
Syntax `component.size(width, height)`
Arguments `width`: width in pixels; `height`: height in pixels
Returns component object

Example:

textinput().size(220, 26);

visible(enabled)

Shows or hides the component.

Item Description
Syntax `component.visible(enabled)`
Arguments `enabled`: boolean
Returns component object

Example:

status.visible(false);

enabled(enabled)

Enables or disables user interaction with the component.

Item Description
Syntax `component.enabled(enabled)`
Arguments `enabled`: boolean
Returns component object

Example:

run_button.enabled(false);

Methods

orientation_left_right()

Places the first pane on the left and the second pane on the right.

Item Description
Syntax `splitpanel.orientation_left_right()`
Arguments none
Returns splitpanel object

Example:

split = splitpanel().orientation_left_right();

orientation_top_bottom()

Places the first pane at the top and the second pane at the bottom.

Item Description
Syntax `splitpanel.orientation_top_bottom()`
Arguments none
Returns splitpanel object

Example:

split = splitpanel().orientation_top_bottom();

resize_mode_proportional()

Keeps the split position proportional when the splitpanel is resized.

Item Description
Syntax `splitpanel.resize_mode_proportional()`
Arguments none
Returns splitpanel object

Example:

split = splitpanel().resize_mode_proportional().split_ratio(0.35);

resize_mode_fixed_first()

Keeps the first pane size fixed when the splitpanel is resized.

Item Description
Syntax `splitpanel.resize_mode_fixed_first()`
Arguments none
Returns splitpanel object

Example:

split = splitpanel().resize_mode_fixed_first().first_size(160);

resize_mode_fixed_second()

Keeps the second pane size fixed when the splitpanel is resized.

Item Description
Syntax `splitpanel.resize_mode_fixed_second()`
Arguments none
Returns splitpanel object

Example:

split = splitpanel().resize_mode_fixed_second().second_size(180);

first(component)

Sets the first pane component.

A component can belong to only one container. The same component cannot be used as both panes.

Item Description
Syntax `splitpanel.first(component)`
Arguments `component`: GUI component object
Returns splitpanel object

Example:

left = panel().border(1);
split = splitpanel().first(left);

second(component)

Sets the second pane component.

A component can belong to only one container. The same component cannot be used as both panes.

Item Description
Syntax `splitpanel.second(component)`
Arguments `component`: GUI component object
Returns splitpanel object

Example:

right = panel().border(1);
split = splitpanel().second(right);

first_visible(enabled)

Shows or hides the first pane.

Item Description
Syntax `splitpanel.first_visible(enabled)`
Arguments `enabled`: boolean
Returns splitpanel object

Example:

split.first_visible(false);

second_visible(enabled)

Shows or hides the second pane.

Item Description
Syntax `splitpanel.second_visible(enabled)`
Arguments `enabled`: boolean
Returns splitpanel object

Example:

split.second_visible(true);

split_ratio(value)

Sets proportional split ratio. Value is clamped to `0..1`.

Item Description
Syntax `splitpanel.split_ratio(value)`
Arguments `value`: ratio from `0` to `1`
Returns splitpanel object

Example:

split = splitpanel().resize_mode_proportional().split_ratio(0.35);

first_size(size)

Sets first pane size in pixels for fixed-size layouts.

Item Description
Syntax `splitpanel.first_size(size)`
Arguments `size`: first pane size in pixels
Returns splitpanel object

Example:

split = splitpanel().resize_mode_fixed_first().first_size(180);

second_size(size)

Sets second pane size in pixels for fixed-size layouts.

Item Description
Syntax `splitpanel.second_size(size)`
Arguments `size`: second pane size in pixels
Returns splitpanel object

Example:

split = splitpanel().resize_mode_fixed_second().second_size(180);

splitter(size)

Sets splitter size in pixels. Minimum splitter size is `2`.

Item Description
Syntax `splitpanel.splitter(size)`
Arguments `size`: splitter size in pixels
Returns splitpanel object

Example:

split = splitpanel().splitter(6);

min_sizes(first, second)

Sets minimum pane sizes in pixels.

Item Description
Syntax `splitpanel.min_sizes(first, second)`
Arguments `first`: minimum first pane size; `second`: minimum second pane size
Returns splitpanel object

Example:

split = splitpanel().min_sizes(80, 120);

Example

left = panel().border(1);
right = panel().border(1);
split = splitpanel()
    .position(10, 10)
    .size(480, 260)
    .first(left)
    .second(right)
    .split_ratio(0.35);
 
window().title('Split').size(520, 320).add(split).show();

Previous: group

Next: label