Up to date
This page is up to date for Godot 4.3
.
If you still find outdated information, please open an issue.
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.
Children can be collapsed/expanded at runtime if you drag against their half minimum size. See collapse_mode for more info.
Tutorials¶
Properties¶
|
||
|
||
|
||
|
||
|
||
|
||
|
Methods¶
void |
|
get_drag_area_control() const |
Theme Properties¶
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
Signals¶
drag_ended() 🔗
Emitted when the user ends dragging.
drag_started() 🔗
Emitted when the user starts dragging.
Emitted when the dragger is dragged by user.
Enumerations¶
enum DraggerVisibility: 🔗
DraggerVisibility DRAGGER_VISIBLE = 0
The split dragger is visible when the cursor hovers it.
The split dragger is never visible.
The split dragger is never visible and its space collapsed.
enum CollapseMode: 🔗
CollapseMode COLLAPSE_NONE = 0
Hiding the first or second sortable control child will result in hiding the dragger and the other control child will fill the visible area.
CollapseMode COLLAPSE_FIRST = 1
Hiding the first sortable control child will keep the dragger visible and you will be able to drag again to show it.
Note: hiding the second sortable control will also hide the dragger.
CollapseMode COLLAPSE_SECOND = 2
Hiding the second sortable control child will keep the dragger visible and you will be able to drag again to show it.
Note: hiding the first sortable control will also hide the dragger.
CollapseMode COLLAPSE_ALL = 3
Hiding the first or second sortable control child will keep the dragger visible and you will be able to drag again to show them.
Note: only one sortable control can be collapsed at time.
Property Descriptions¶
CollapseMode collapse_mode = 0
🔗
void set_collapse_mode(value: CollapseMode)
CollapseMode get_collapse_mode()
Can allow the first child or second child or both of them to be collapsed when they are not visible. See CollapseMode for details.
Children can be visible/hidden while dragging, if the mouse position becomes greater than their half size, they will hide otherwise they will show if they are hidden.
If true
, the dragger will be disabled and the children will be sized as if the split_offset was 0
.
bool drag_area_highlight_in_editor = false
🔗
Highlights the drag area Rect2 so you can see where it is during development. The drag area is gold if dragging_enabled is true
, and red if false
.
DraggerVisibility dragger_visibility = 0
🔗
void set_dragger_visibility(value: DraggerVisibility)
DraggerVisibility get_dragger_visibility()
Determines the dragger's visibility. See DraggerVisibility for details.
bool dragging_enabled = true
🔗
Enables or disables split dragging.
The initial offset of the splitting between the two Controls, with 0
being at the end of the first Control.
If true
, the SplitContainer will arrange its children vertically, rather than horizontally.
Can't be changed when using HSplitContainer and VSplitContainer.
Method Descriptions¶
void clamp_split_offset() 🔗
Clamps the split_offset value to not go outside the currently possible minimal and maximum values.
Control get_drag_area_control() const 🔗
Returns the drag area Control. For example, you can move a pre-configured button into the drag area Control so that it rides along with the split bar. Try setting the Button anchors to center
prior to the reparent()
call.
$BarnacleButton.reparent($SplitContainer.get_drag_area_control())
Note: The drag area Control is drawn over the SplitContainer's children, so CanvasItem draw objects called from the Control and children added to the Control will also appear over the SplitContainer's children. Try setting Control.mouse_filter of custom children to Control.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¶
Color grabber_icon_normal = Color(0.875, 0.875, 0.875, 0.6)
🔗
The grabber icon normal color.
Color grabber_icon_pressed = Color(0.226, 0.478, 0.921, 1)
🔗
The grabber icon pressed color.
Boolean value. If 1 (true
), the grabber icon will hide automatically when it isn't under the cursor. If 0 (false
), it's always visible.
Boolean value. If 1 (true
), the split bar background will hide automatically when it isn't under the cursor. If 0 (false
), it's always visible.
If 1 (true
), the grabber icon will be visible. If 0 (false
), it will be hidden.
If 1 (true
), the split bar background will be visible. If 0 (false
), it will be hidden.
int minimum_grab_thickness = 6
🔗
The minimum thickness of the area users can click on to grab the splitting line. If separation or h_grabber / v_grabber's thickness are too small, this ensure that the splitting line can still be dragged.
The space between sides of the container.
The icon used for the grabber drawn in the middle area.
The icon used for the grabber drawn in the middle area when vertical is false
.
The icon used for the grabber drawn in the middle area when vertical is true
.
StyleBox h_split_bar_background 🔗
Determines the background of the split bar when vertical is false
.
StyleBox split_bar_background 🔗
Determines the background of the split bar. Can have expand margins to draw outside the bounds.
StyleBox v_split_bar_background 🔗
Determines the background of the split bar when vertical is true
.