SplitContainer

Inherits:Container<Control<CanvasItem<Node<Object

Inherited By:HSplitContainer,VSplitContainer

A container that splits two child controls horizontally or vertically and provides a grabber for adjusting the split ratio.

Description

A container that accepts only two child controls, then arranges them horizontally or vertically and creates a divisor between them. The divisor can be dragged around to change the size relation between the child controls.

Tutorials

Properties

bool

collapsed

false

bool

drag_area_highlight_in_editor

false

int

drag_area_margin_begin

0

int

drag_area_margin_end

0

int

drag_area_offset

0

DraggerVisibility

dragger_visibility

0

bool

dragging_enabled

true

int

split_offset

0

bool

vertical

false

Methods

void

clamp_split_offset()

Control

get_drag_area_control()

Theme Properties

int

autohide

1

int

minimum_grab_thickness

6

int

separation

12

Texture2D

grabber

Texture2D

h_grabber

Texture2D

v_grabber

StyleBox

split_bar_background


Signals

drag_ended()🔗

Emitted when the user ends dragging.


drag_started()🔗

Emitted when the user starts dragging.


dragged(offset:int)🔗

Emitted when the dragger is dragged by user.


Enumerations

enumDraggerVisibility:🔗

DraggerVisibilityDRAGGER_VISIBLE =0

The split dragger icon is always visible whenautohide isfalse, otherwise visible only when the cursor hovers it.

The size of the grabber icon determines the minimumseparation.

The dragger icon is automatically hidden if the length of the grabber icon is longer than the split bar.

DraggerVisibilityDRAGGER_HIDDEN =1

The split dragger icon is never visible regardless of the value ofautohide.

The size of the grabber icon determines the minimumseparation.

DraggerVisibilityDRAGGER_HIDDEN_COLLAPSED =2

The split dragger icon is not visible, and the split bar is collapsed to zero thickness.


Property Descriptions

boolcollapsed =false🔗

Iftrue, the dragger will be disabled and the children will be sized as if thesplit_offset was0.


booldrag_area_highlight_in_editor =false🔗

Highlights the drag areaRect2 so you can see where it is during development. The drag area is gold ifdragging_enabled istrue, and red iffalse.


intdrag_area_margin_begin =0🔗

Reduces the size of the drag area and split barsplit_bar_background at the beginning of the container.


intdrag_area_margin_end =0🔗

Reduces the size of the drag area and split barsplit_bar_background at the end of the container.


intdrag_area_offset =0🔗

Shifts the drag area in the axis of the container to prevent the drag area from overlapping theScrollBar or other selectableControl of a child node.


DraggerVisibilitydragger_visibility =0🔗

Determines the dragger's visibility. SeeDraggerVisibility for details. This property does not determine whether dragging is enabled or not. Usedragging_enabled for that.


booldragging_enabled =true🔗

Enables or disables split dragging.


intsplit_offset =0🔗

The initial offset of the splitting between the twoControls, with0 being at the end of the firstControl.


boolvertical =false🔗

Iftrue, theSplitContainer will arrange its children vertically, rather than horizontally.

Can't be changed when usingHSplitContainer andVSplitContainer.


Method Descriptions

voidclamp_split_offset()🔗

Clamps thesplit_offset value to not go outside the currently possible minimal and maximum values.


Controlget_drag_area_control()🔗

Returns the drag areaControl. For example, you can move a pre-configured button into the drag areaControl so that it rides along with the split bar. Try setting theButton anchors tocenter prior to thereparent() call.

$BarnacleButton.reparent($SplitContainer.get_drag_area_control())

Note: The drag areaControl is drawn over theSplitContainer's children, soCanvasItem draw objects called from theControl and children added to theControl will also appear over theSplitContainer's children. Try settingControl.mouse_filter of custom children toControl.MOUSE_FILTER_IGNORE to prevent blocking the mouse from dragging if desired.

Warning: This is a required internal node, removing and freeing it may cause a crash.


Theme Property Descriptions

intautohide =1🔗

Boolean value. If1 (true), the grabber will hide automatically when it isn't under the cursor. If0 (false), it's always visible. Thedragger_visibility must beDRAGGER_VISIBLE.


intminimum_grab_thickness =6🔗

The minimum thickness of the area users can click on to grab the split bar. This ensures that the split bar can still be dragged ifseparation orh_grabber /v_grabber's size is too narrow to easily select.


intseparation =12🔗

The split bar thickness, i.e., the gap between the two children of the container. This is overridden by the size of the grabber icon ifdragger_visibility is set toDRAGGER_VISIBLE, orDRAGGER_HIDDEN, andseparation is smaller than the size of the grabber icon in the same axis.

Note: To obtainseparation values less than the size of the grabber icon, for example a1px hairline, seth_grabber orv_grabber to a newImageTexture, which effectively sets the grabber icon size to0px.


Texture2Dgrabber🔗

The icon used for the grabber drawn in the middle area.


Texture2Dh_grabber🔗

The icon used for the grabber drawn in the middle area whenvertical isfalse.


Texture2Dv_grabber🔗

The icon used for the grabber drawn in the middle area whenvertical istrue.


StyleBoxsplit_bar_background🔗

Determines the background of the split bar if its thickness is greater than zero.


User-contributed notes

Please read theUser-contributed notes policy before submitting a comment.