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
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
|
Methods
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
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
boolis_collapsed()
Iftrue
, the dragger will be disabled and the children will be sized as if thesplit_offset was0
.
booldrag_area_highlight_in_editor =false
🔗
boolis_drag_area_highlight_in_editor_enabled()
Highlights the drag areaRect2 so you can see where it is during development. The drag area is gold ifdragging_enabled istrue
, and red iffalse
.
intget_drag_area_margin_begin()
Reduces the size of the drag area and split barsplit_bar_background at the beginning of the container.
intget_drag_area_margin_end()
Reduces the size of the drag area and split barsplit_bar_background at the end of the container.
intget_drag_area_offset()
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
🔗
DraggerVisibilityget_dragger_visibility()
Determines the dragger's visibility. SeeDraggerVisibility for details. This property does not determine whether dragging is enabled or not. Usedragging_enabled for that.
boolis_dragging_enabled()
Enables or disables split dragging.
intget_split_offset()
The initial offset of the splitting between the twoControls, with0
being at the end of the firstControl.
boolis_vertical()
Iftrue
, theSplitContainer will arrange its children vertically, rather than horizontally.
Can't be changed when usingHSplitContainer andVSplitContainer.
Method Descriptions
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
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.
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.
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
.
The icon used for the grabber drawn in the middle area.
The icon used for the grabber drawn in the middle area whenvertical isfalse
.
The icon used for the grabber drawn in the middle area whenvertical istrue
.
Determines the background of the split bar if its thickness is greater than zero.