:github_url: hide .. Generated automatically by doc/tools/make_rst.py in Godot's source tree. .. DO NOT EDIT THIS FILE, but the ScrollContainer.xml source instead. .. The source is found in doc/classes or modules//doc_classes. .. _class_ScrollContainer: ScrollContainer =============== **Inherits:** :ref:`Container` **<** :ref:`Control` **<** :ref:`CanvasItem` **<** :ref:`Node` **<** :ref:`Object` **Inherited By:** :ref:`EditorInspector` A helper node for displaying scrollable elements such as lists. Description ----------- A ScrollContainer node meant to contain a :ref:`Control` child. ScrollContainers will automatically create a scrollbar child (:ref:`HScrollBar`, :ref:`VScrollBar`, or both) when needed and will only draw the Control within the ScrollContainer area. Scrollbars will automatically be drawn at the right (for vertical) or bottom (for horizontal) and will enable dragging to move the viewable Control (and its children) within the ScrollContainer. Scrollbars will also automatically resize the grabber based on the :ref:`Control.minimum_size` of the Control relative to the ScrollContainer. Works great with a :ref:`Panel` control. You can set ``EXPAND`` on the children's size flags, so they will upscale to the ScrollContainer's size if it's larger (scroll is invisible for the chosen dimension). Properties ---------- +----------------------------------------------------+--------------------------------------------------------------------------------------+---------------------------------------------------------------------------+ | :ref:`bool` | clip_contents | ``true`` (overrides :ref:`Control`) | +----------------------------------------------------+--------------------------------------------------------------------------------------+---------------------------------------------------------------------------+ | :ref:`bool` | :ref:`follow_focus` | ``false`` | +----------------------------------------------------+--------------------------------------------------------------------------------------+---------------------------------------------------------------------------+ | :ref:`ScrollMode` | :ref:`horizontal_scroll_mode` | ``1`` | +----------------------------------------------------+--------------------------------------------------------------------------------------+---------------------------------------------------------------------------+ | :ref:`int` | :ref:`scroll_deadzone` | ``0`` | +----------------------------------------------------+--------------------------------------------------------------------------------------+---------------------------------------------------------------------------+ | :ref:`int` | :ref:`scroll_horizontal` | ``0`` | +----------------------------------------------------+--------------------------------------------------------------------------------------+---------------------------------------------------------------------------+ | :ref:`int` | :ref:`scroll_vertical` | ``0`` | +----------------------------------------------------+--------------------------------------------------------------------------------------+---------------------------------------------------------------------------+ | :ref:`ScrollMode` | :ref:`vertical_scroll_mode` | ``1`` | +----------------------------------------------------+--------------------------------------------------------------------------------------+---------------------------------------------------------------------------+ Methods ------- +-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`ensure_control_visible` **(** :ref:`Control` control **)** | +-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`HScrollBar` | :ref:`get_h_scroll_bar` **(** **)** | +-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`VScrollBar` | :ref:`get_v_scroll_bar` **(** **)** | +-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+ Theme Properties ---------------- +---------------------------------+-------------------------------------------------+ | :ref:`StyleBox` | :ref:`bg` | +---------------------------------+-------------------------------------------------+ Signals ------- .. _class_ScrollContainer_signal_scroll_ended: - **scroll_ended** **(** **)** Emitted when scrolling stops. ---- .. _class_ScrollContainer_signal_scroll_started: - **scroll_started** **(** **)** Emitted when scrolling is started. Enumerations ------------ .. _enum_ScrollContainer_ScrollMode: .. _class_ScrollContainer_constant_SCROLL_MODE_DISABLED: .. _class_ScrollContainer_constant_SCROLL_MODE_AUTO: .. _class_ScrollContainer_constant_SCROLL_MODE_SHOW_ALWAYS: .. _class_ScrollContainer_constant_SCROLL_MODE_SHOW_NEVER: enum **ScrollMode**: - **SCROLL_MODE_DISABLED** = **0** --- Scrolling disabled, scrollbar will be invisible. - **SCROLL_MODE_AUTO** = **1** --- Scrolling enabled, scrollbar will be visible only if necessary, i.e. container's content is bigger than the container. - **SCROLL_MODE_SHOW_ALWAYS** = **2** --- Scrolling enabled, scrollbar will be always visible. - **SCROLL_MODE_SHOW_NEVER** = **3** --- Scrolling enabled, scrollbar will be hidden. Property Descriptions --------------------- .. _class_ScrollContainer_property_follow_focus: - :ref:`bool` **follow_focus** +-----------+-------------------------+ | *Default* | ``false`` | +-----------+-------------------------+ | *Setter* | set_follow_focus(value) | +-----------+-------------------------+ | *Getter* | is_following_focus() | +-----------+-------------------------+ If ``true``, the ScrollContainer will automatically scroll to focused children (including indirect children) to make sure they are fully visible. ---- .. _class_ScrollContainer_property_horizontal_scroll_mode: - :ref:`ScrollMode` **horizontal_scroll_mode** +-----------+-----------------------------------+ | *Default* | ``1`` | +-----------+-----------------------------------+ | *Setter* | set_horizontal_scroll_mode(value) | +-----------+-----------------------------------+ | *Getter* | get_horizontal_scroll_mode() | +-----------+-----------------------------------+ Controls whether horizontal scrollbar can be used and when it should be visible. See :ref:`ScrollMode` for options. ---- .. _class_ScrollContainer_property_scroll_deadzone: - :ref:`int` **scroll_deadzone** +-----------+---------------------+ | *Default* | ``0`` | +-----------+---------------------+ | *Setter* | set_deadzone(value) | +-----------+---------------------+ | *Getter* | get_deadzone() | +-----------+---------------------+ ---- .. _class_ScrollContainer_property_scroll_horizontal: - :ref:`int` **scroll_horizontal** +-----------+---------------------+ | *Default* | ``0`` | +-----------+---------------------+ | *Setter* | set_h_scroll(value) | +-----------+---------------------+ | *Getter* | get_h_scroll() | +-----------+---------------------+ The current horizontal scroll value. ---- .. _class_ScrollContainer_property_scroll_vertical: - :ref:`int` **scroll_vertical** +-----------+---------------------+ | *Default* | ``0`` | +-----------+---------------------+ | *Setter* | set_v_scroll(value) | +-----------+---------------------+ | *Getter* | get_v_scroll() | +-----------+---------------------+ The current vertical scroll value. ---- .. _class_ScrollContainer_property_vertical_scroll_mode: - :ref:`ScrollMode` **vertical_scroll_mode** +-----------+---------------------------------+ | *Default* | ``1`` | +-----------+---------------------------------+ | *Setter* | set_vertical_scroll_mode(value) | +-----------+---------------------------------+ | *Getter* | get_vertical_scroll_mode() | +-----------+---------------------------------+ Controls whether vertical scrollbar can be used and when it should be visible. See :ref:`ScrollMode` for options. Method Descriptions ------------------- .. _class_ScrollContainer_method_ensure_control_visible: - void **ensure_control_visible** **(** :ref:`Control` control **)** Ensures the given ``control`` is visible (must be a direct or indirect child of the ScrollContainer). Used by :ref:`follow_focus`. \ **Note:** This will not work on a node that was just added during the same frame. If you want to scroll to a newly added child, you must wait until the next frame using :ref:`SceneTree.process_frame`: :: add_child(child_node) await get_tree().process_frame ensure_control_visible(child_node) ---- .. _class_ScrollContainer_method_get_h_scroll_bar: - :ref:`HScrollBar` **get_h_scroll_bar** **(** **)** Returns the horizontal scrollbar :ref:`HScrollBar` of this ``ScrollContainer``. \ **Warning:** This is a required internal node, removing and freeing it may cause a crash. If you wish to disable or hide a scrollbar, you can use :ref:`horizontal_scroll_mode`. ---- .. _class_ScrollContainer_method_get_v_scroll_bar: - :ref:`VScrollBar` **get_v_scroll_bar** **(** **)** Returns the vertical scrollbar :ref:`VScrollBar` of this ``ScrollContainer``. \ **Warning:** This is a required internal node, removing and freeing it may cause a crash. If you wish to disable or hide a scrollbar, you can use :ref:`vertical_scroll_mode`. Theme Property Descriptions --------------------------- .. _class_ScrollContainer_theme_style_bg: - :ref:`StyleBox` **bg** The background :ref:`StyleBox` of the ``ScrollContainer``. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)` .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)` .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)` .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)` .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)` .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`