Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

SplitContainer

Hereda: Container < Control < CanvasItem < Node < Object

Heredado por: HSplitContainer, VSplitContainer

Un contenedor que organiza controles hijo horizontal o verticalmente y proporciona agarradores para ajustar las proporciones de división entre ellos.

Descripción

Un contenedor que organiza controles hijo horizontal o verticalmente y crea agarradores entre ellos. Los agarradores se pueden arrastrar para cambiar las relaciones de tamaño entre los controles hijo.

Tutoriales

Propiedades

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

bool

drag_nested_intersections

false

DraggerVisibility

dragger_visibility

0

bool

dragging_enabled

true

int

split_offset

0

PackedInt32Array

split_offsets

PackedInt32Array(0)

bool

touch_dragger_enabled

false

bool

vertical

false

Métodos

void

clamp_split_offset(priority_index: int = 0)

Control

get_drag_area_control()

Array[Control]

get_drag_area_controls()

Propiedades del Tema

Color

touch_dragger_color

Color(1, 1, 1, 0.3)

Color

touch_dragger_hover_color

Color(1, 1, 1, 0.6)

Color

touch_dragger_pressed_color

Color(1, 1, 1, 1)

int

autohide

1

int

minimum_grab_thickness

6

int

separation

12

Texture2D

grabber

Texture2D

h_grabber

Texture2D

h_touch_dragger

Texture2D

touch_dragger

Texture2D

v_grabber

Texture2D

v_touch_dragger

StyleBox

split_bar_background


Señales

drag_ended() 🔗

Emitida cuando el usuario deja de arrastrar.


drag_started() 🔗

Emitida cuando el usuario comienza a arrastrar.


dragged(offset: int) 🔗

Emitted when any dragger is dragged by user.


Enumeraciones

enum DraggerVisibility: 🔗

DraggerVisibility DRAGGER_VISIBLE = 0

El icono del divisor siempre está visible cuando autohide es false, de lo contrario, solo es visible cuando el cursor lo sobrevuela.

El tamaño del icono del divisor determina la separation mínima.

El icono del divisor se oculta automáticamente si la longitud del icono del divisor es mayor que la barra divisoria.

DraggerVisibility DRAGGER_HIDDEN = 1

El icono del divisor nunca es visible independientemente del valor de autohide.

El tamaño del icono del divisor determina la separation mínima.

DraggerVisibility DRAGGER_HIDDEN_COLLAPSED = 2

El icono del divisor no está visible, y la barra divisoria se reduce a cero de grosor.


Descripciones de Propiedades

bool collapsed = false 🔗

  • void set_collapsed(value: bool)

  • bool is_collapsed()

Si es true, los arrastradores estarán desactivados y los hijos se dimensionarán como si todos los split_offsets fueran 0.


bool drag_area_highlight_in_editor = false 🔗

  • void set_drag_area_highlight_in_editor(value: bool)

  • bool is_drag_area_highlight_in_editor_enabled()

Resalta el área de arrastre Rect2 para que puedas ver dónde está durante el desarrollo. El área de arrastre es dorada si dragging_enabled es true, y roja si es false.


int drag_area_margin_begin = 0 🔗

  • void set_drag_area_margin_begin(value: int)

  • int get_drag_area_margin_begin()

Reduce el tamaño del área de arrastre y la barra divisoria split_bar_background al principio del contenedor.


int drag_area_margin_end = 0 🔗

  • void set_drag_area_margin_end(value: int)

  • int get_drag_area_margin_end()

Reduce el tamaño del área de arrastre y la barra divisoria split_bar_background al final del contenedor.


int drag_area_offset = 0 🔗

  • void set_drag_area_offset(value: int)

  • int get_drag_area_offset()

Desplaza el área de arrastre en el eje del contenedor para evitar que el área de arrastre se superponga al ScrollBar u otro Control seleccionable de un nodo hijo.


bool drag_nested_intersections = false 🔗

  • void set_drag_nested_intersections(value: bool)

  • bool is_dragging_nested_intersections()

Adds extra draggers at the intersection of the draggers of two SplitContainers to allow dragging both at once. This must be set to true for both SplitContainers, and one needs to be a descendant of the other. They also must be orthogonal (their vertical are different) and the descendant must be next to at least one of the ancestor's draggers (within minimum_grab_thickness).


DraggerVisibility dragger_visibility = 0 🔗

Determina la visibilidad del arrastrador. Esta propiedad no determina si el arrastre está habilitado o no. Usa dragging_enabled para eso.


bool dragging_enabled = true 🔗

  • void set_dragging_enabled(value: bool)

  • bool is_dragging_enabled()

Activa o desactiva el arrastre de la división.


int split_offset = 0 🔗

  • void set_split_offset(value: int)

  • int get_split_offset()

Obsoleto: Use split_offsets instead. The first element of the array is the split offset between the first two children.

El primer elemento de split_offsets.


PackedInt32Array split_offsets = PackedInt32Array(0) 🔗

Offsets for each dragger in pixels. Each one is the offset of the split between the Control nodes before and after the dragger, with 0 being the default position. The default position is based on the Control nodes expand flags and minimum sizes. See Control.size_flags_horizontal, Control.size_flags_vertical, and Control.size_flags_stretch_ratio.

If none of the Control nodes before the dragger are expanded, the default position will be at the start of the SplitContainer. If none of the Control nodes after the dragger are expanded, the default position will be at the end of the SplitContainer. If the dragger is in between expanded Control nodes, the default position will be in the middle, based on the Control.size_flags_stretch_ratios and minimum sizes.

Note: If the split offsets cause Control nodes to overlap, the first split will take priority when resolving the positions.

Note: The returned array is copied and any changes to it will not update the original property value. See PackedInt32Array for more details.


bool touch_dragger_enabled = false 🔗

  • void set_touch_dragger_enabled(value: bool)

  • bool is_touch_dragger_enabled()

Si es true, se habilitará un asa de arrastre táctil para mejorar la usabilidad en pantallas más pequeñas. A diferencia del agarrador estándar, esta asa de arrastre se superpone a los hijos de SplitContainer y no afecta su separación mínima. El agarrador estándar ya no se dibujará cuando esta opción esté habilitada.


bool vertical = false 🔗

  • void set_vertical(value: bool)

  • bool is_vertical()

Si es true, el SplitContainer organizará a sus hijos verticalmente, en lugar de horizontalmente.

No se puede cambiar cuando se usa HSplitContainer y VSplitContainer.


Descripciones de Métodos

void clamp_split_offset(priority_index: int = 0) 🔗

Limita los valores de split_offsets para asegurar que estén dentro de rangos válidos y que no se superpongan entre sí. Cuando ocurren superposiciones, este método prioriza un desplazamiento de división (en el índice priority_index) al limitar cualquier desplazamiento de división superpuesto a este.


Control get_drag_area_control() 🔗

Obsoleto: Use the first element of get_drag_area_controls() instead.

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.


Array[Control] get_drag_area_controls() 🔗

Returns an Array of the drag area Controls. These are the interactable Control nodes between each child. For example, this can be used to add a pre-configured button to a drag area Control so that it rides along with the split bar. Try setting the Button anchors to center prior to the Node.reparent() call.

$BarnacleButton.reparent($SplitContainer.get_drag_area_controls()[0])

Note: The drag area Controls are drawn over the SplitContainer's children, so CanvasItem draw objects called from a drag area and children added to it 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: These are required internal nodes, removing or freeing them may cause a crash.


Descripciones de las propiedades del tema

Color touch_dragger_color = Color(1, 1, 1, 0.3) 🔗

El color del control táctil de arrastre.


Color touch_dragger_hover_color = Color(1, 1, 1, 0.6) 🔗

El color del control táctil de arrastre cuando está en foco.


Color touch_dragger_pressed_color = Color(1, 1, 1, 1) 🔗

El color del control táctil de arrastre cuando se pulsa.


int autohide = 1 🔗

Boolean value. If 1 (true), the grabbers will hide automatically when they aren't under the cursor. If 0 (false), the grabbers are always visible. The dragger_visibility must be DRAGGER_VISIBLE.


int minimum_grab_thickness = 6 🔗

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


int separation = 12 🔗

The split bar thickness, i.e., the gap between each child of the container. This is overridden by the size of the grabber icon if dragger_visibility is set to DRAGGER_VISIBLE, or DRAGGER_HIDDEN, and separation is smaller than the size of the grabber icon in the same axis.

Note: To obtain separation values less than the size of the grabber icon, for example a 1 px hairline, set h_grabber or v_grabber to a new ImageTexture, which effectively sets the grabber icon size to 0 px.


Texture2D grabber 🔗

The icon used for the grabbers drawn in the separations. This is only used in HSplitContainer and VSplitContainer. For SplitContainer, see h_grabber and v_grabber instead.


Texture2D h_grabber 🔗

The icon used for the grabbers drawn in the separations when vertical is false.


Texture2D h_touch_dragger 🔗

El icono usado para el control de arrastre cuando touch_dragger_enabled es true y vertical es false.


Texture2D touch_dragger 🔗

El icono utilizado para el control de arrastre cuando touch_dragger_enabled es true. Esto solo se usa en HSplitContainer y VSplitContainer. Para SplitContainer, mira h_touch_dragger y v_touch_dragger en su lugar.


Texture2D v_grabber 🔗

The icon used for the grabbers drawn in the separations when vertical is true.


Texture2D v_touch_dragger 🔗

El icono usado para el control de arrastre cuando touch_dragger_enabled es true y vertical es true.


StyleBox split_bar_background 🔗

Determina el fondo de la barra divisoria si su grosor es mayor que cero.