123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221 |
- :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/<name>/doc_classes.
- .. _class_ScrollContainer:
- ScrollContainer
- ===============
- **Inherits:** :ref:`Container<class_Container>` **<** :ref:`Control<class_Control>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
- **Inherited By:** :ref:`EditorInspector<class_EditorInspector>`
- A helper node for displaying scrollable elements such as lists.
- Description
- -----------
- A ScrollContainer node meant to contain a :ref:`Control<class_Control>` child. ScrollContainers will automatically create a scrollbar child (:ref:`HScrollBar<class_HScrollBar>`, :ref:`VScrollBar<class_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.rect_min_size<class_Control_property_rect_min_size>` of the Control relative to the ScrollContainer. Works great with a :ref:`Panel<class_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<class_bool>` | :ref:`follow_focus<class_ScrollContainer_property_follow_focus>` | ``false`` |
- +-------------------------+--------------------------------------------------------------------------------------------+------------------------------+
- | :ref:`bool<class_bool>` | rect_clip_content | ``true`` *(parent override)* |
- +-------------------------+--------------------------------------------------------------------------------------------+------------------------------+
- | :ref:`int<class_int>` | :ref:`scroll_deadzone<class_ScrollContainer_property_scroll_deadzone>` | ``0`` |
- +-------------------------+--------------------------------------------------------------------------------------------+------------------------------+
- | :ref:`int<class_int>` | :ref:`scroll_horizontal<class_ScrollContainer_property_scroll_horizontal>` | ``0`` |
- +-------------------------+--------------------------------------------------------------------------------------------+------------------------------+
- | :ref:`bool<class_bool>` | :ref:`scroll_horizontal_enabled<class_ScrollContainer_property_scroll_horizontal_enabled>` | ``true`` |
- +-------------------------+--------------------------------------------------------------------------------------------+------------------------------+
- | :ref:`int<class_int>` | :ref:`scroll_vertical<class_ScrollContainer_property_scroll_vertical>` | ``0`` |
- +-------------------------+--------------------------------------------------------------------------------------------+------------------------------+
- | :ref:`bool<class_bool>` | :ref:`scroll_vertical_enabled<class_ScrollContainer_property_scroll_vertical_enabled>` | ``true`` |
- +-------------------------+--------------------------------------------------------------------------------------------+------------------------------+
- Methods
- -------
- +-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`ensure_control_visible<class_ScrollContainer_method_ensure_control_visible>` **(** :ref:`Control<class_Control>` control **)** |
- +-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`HScrollBar<class_HScrollBar>` | :ref:`get_h_scrollbar<class_ScrollContainer_method_get_h_scrollbar>` **(** **)** |
- +-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`VScrollBar<class_VScrollBar>` | :ref:`get_v_scrollbar<class_ScrollContainer_method_get_v_scrollbar>` **(** **)** |
- +-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
- Theme Properties
- ----------------
- +---------------------------------+-------------------------------------------------+
- | :ref:`StyleBox<class_StyleBox>` | :ref:`bg<class_ScrollContainer_theme_style_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.
- Property Descriptions
- ---------------------
- .. _class_ScrollContainer_property_follow_focus:
- - :ref:`bool<class_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_scroll_deadzone:
- - :ref:`int<class_int>` **scroll_deadzone**
- +-----------+---------------------+
- | *Default* | ``0`` |
- +-----------+---------------------+
- | *Setter* | set_deadzone(value) |
- +-----------+---------------------+
- | *Getter* | get_deadzone() |
- +-----------+---------------------+
- ----
- .. _class_ScrollContainer_property_scroll_horizontal:
- - :ref:`int<class_int>` **scroll_horizontal**
- +-----------+---------------------+
- | *Default* | ``0`` |
- +-----------+---------------------+
- | *Setter* | set_h_scroll(value) |
- +-----------+---------------------+
- | *Getter* | get_h_scroll() |
- +-----------+---------------------+
- The current horizontal scroll value.
- ----
- .. _class_ScrollContainer_property_scroll_horizontal_enabled:
- - :ref:`bool<class_bool>` **scroll_horizontal_enabled**
- +-----------+----------------------------+
- | *Default* | ``true`` |
- +-----------+----------------------------+
- | *Setter* | set_enable_h_scroll(value) |
- +-----------+----------------------------+
- | *Getter* | is_h_scroll_enabled() |
- +-----------+----------------------------+
- If ``true``, enables horizontal scrolling.
- ----
- .. _class_ScrollContainer_property_scroll_vertical:
- - :ref:`int<class_int>` **scroll_vertical**
- +-----------+---------------------+
- | *Default* | ``0`` |
- +-----------+---------------------+
- | *Setter* | set_v_scroll(value) |
- +-----------+---------------------+
- | *Getter* | get_v_scroll() |
- +-----------+---------------------+
- The current vertical scroll value.
- ----
- .. _class_ScrollContainer_property_scroll_vertical_enabled:
- - :ref:`bool<class_bool>` **scroll_vertical_enabled**
- +-----------+----------------------------+
- | *Default* | ``true`` |
- +-----------+----------------------------+
- | *Setter* | set_enable_v_scroll(value) |
- +-----------+----------------------------+
- | *Getter* | is_v_scroll_enabled() |
- +-----------+----------------------------+
- If ``true``, enables vertical scrolling.
- Method Descriptions
- -------------------
- .. _class_ScrollContainer_method_ensure_control_visible:
- - void **ensure_control_visible** **(** :ref:`Control<class_Control>` control **)**
- Ensures the given ``control`` is visible (must be a direct or indirect child of the ScrollContainer). Used by :ref:`follow_focus<class_ScrollContainer_property_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.idle_frame<class_SceneTree_signal_idle_frame>`:
- ::
- add_child(child_node)
- yield(get_tree(), "idle_frame")
- ensure_control_visible(child_node)
- ----
- .. _class_ScrollContainer_method_get_h_scrollbar:
- - :ref:`HScrollBar<class_HScrollBar>` **get_h_scrollbar** **(** **)**
- Returns the horizontal scrollbar :ref:`HScrollBar<class_HScrollBar>` of this ``ScrollContainer``.
- **Warning:** This is a required internal node, removing and freeing it may cause a crash. If you wish to disable the horizontal scrollbar, use :ref:`scroll_horizontal_enabled<class_ScrollContainer_property_scroll_horizontal_enabled>`. If you want to only hide it instead, use its :ref:`CanvasItem.visible<class_CanvasItem_property_visible>` property.
- ----
- .. _class_ScrollContainer_method_get_v_scrollbar:
- - :ref:`VScrollBar<class_VScrollBar>` **get_v_scrollbar** **(** **)**
- Returns the vertical scrollbar :ref:`VScrollBar<class_VScrollBar>` of this ``ScrollContainer``.
- **Warning:** This is a required internal node, removing and freeing it may cause a crash. If you wish to disable the vertical scrollbar, use :ref:`scroll_vertical_enabled<class_ScrollContainer_property_scroll_vertical_enabled>`. If you want to only hide it instead, use its :ref:`CanvasItem.visible<class_CanvasItem_property_visible>` property.
- Theme Property Descriptions
- ---------------------------
- .. _class_ScrollContainer_theme_style_bg:
- - :ref:`StyleBox<class_StyleBox>` **bg**
- The background :ref:`StyleBox<class_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.)`
|