mirror of
https://github.com/godotengine/godot-docs-l10n.git
synced 2025-12-31 09:49:22 +03:00
577 lines
27 KiB
ReStructuredText
577 lines
27 KiB
ReStructuredText
:github_url: hide
|
||
|
||
.. _class_ScrollContainer:
|
||
|
||
ScrollContainer
|
||
===============
|
||
|
||
**继承:** :ref:`Container<class_Container>` **<** :ref:`Control<class_Control>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
|
||
|
||
**派生:** :ref:`EditorInspector<class_EditorInspector>`
|
||
|
||
需要时能够为子控件提供滚动条的容器。
|
||
|
||
.. rst-class:: classref-introduction-group
|
||
|
||
描述
|
||
----
|
||
|
||
用于在需要时为子控件提供滚动条的容器。滚动条会自动绘制在右侧(垂直滚动条)或底部(水平滚动条),拖动滚动条能够移动 ScrollContainer 中的可见 Control(及其子项)。滚动条会根据该 Control 的 :ref:`Control.custom_minimum_size<class_Control_property_custom_minimum_size>` 相对于 ScrollContainer 的大小自动调整抓取器的大小。
|
||
|
||
.. rst-class:: classref-introduction-group
|
||
|
||
教程
|
||
----
|
||
|
||
- :doc:`使用容器 <../tutorials/ui/gui_containers>`
|
||
|
||
.. rst-class:: classref-reftable-group
|
||
|
||
属性
|
||
----
|
||
|
||
.. table::
|
||
:widths: auto
|
||
|
||
+------------------------------------------------------------+----------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
|
||
| :ref:`bool<class_bool>` | clip_contents | ``true`` (overrides :ref:`Control<class_Control_property_clip_contents>`) |
|
||
+------------------------------------------------------------+----------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
|
||
| :ref:`bool<class_bool>` | :ref:`draw_focus_border<class_ScrollContainer_property_draw_focus_border>` | ``false`` |
|
||
+------------------------------------------------------------+----------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
|
||
| :ref:`bool<class_bool>` | :ref:`follow_focus<class_ScrollContainer_property_follow_focus>` | ``false`` |
|
||
+------------------------------------------------------------+----------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
|
||
| :ref:`ScrollMode<enum_ScrollContainer_ScrollMode>` | :ref:`horizontal_scroll_mode<class_ScrollContainer_property_horizontal_scroll_mode>` | ``1`` |
|
||
+------------------------------------------------------------+----------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
|
||
| :ref:`int<class_int>` | :ref:`scroll_deadzone<class_ScrollContainer_property_scroll_deadzone>` | ``0`` |
|
||
+------------------------------------------------------------+----------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
|
||
| :ref:`ScrollHintMode<enum_ScrollContainer_ScrollHintMode>` | :ref:`scroll_hint_mode<class_ScrollContainer_property_scroll_hint_mode>` | ``0`` |
|
||
+------------------------------------------------------------+----------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
|
||
| :ref:`int<class_int>` | :ref:`scroll_horizontal<class_ScrollContainer_property_scroll_horizontal>` | ``0`` |
|
||
+------------------------------------------------------------+----------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
|
||
| :ref:`float<class_float>` | :ref:`scroll_horizontal_custom_step<class_ScrollContainer_property_scroll_horizontal_custom_step>` | ``-1.0`` |
|
||
+------------------------------------------------------------+----------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
|
||
| :ref:`int<class_int>` | :ref:`scroll_vertical<class_ScrollContainer_property_scroll_vertical>` | ``0`` |
|
||
+------------------------------------------------------------+----------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
|
||
| :ref:`float<class_float>` | :ref:`scroll_vertical_custom_step<class_ScrollContainer_property_scroll_vertical_custom_step>` | ``-1.0`` |
|
||
+------------------------------------------------------------+----------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
|
||
| :ref:`bool<class_bool>` | :ref:`tile_scroll_hint<class_ScrollContainer_property_tile_scroll_hint>` | ``false`` |
|
||
+------------------------------------------------------------+----------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
|
||
| :ref:`ScrollMode<enum_ScrollContainer_ScrollMode>` | :ref:`vertical_scroll_mode<class_ScrollContainer_property_vertical_scroll_mode>` | ``1`` |
|
||
+------------------------------------------------------------+----------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
|
||
|
||
.. rst-class:: classref-reftable-group
|
||
|
||
方法
|
||
----
|
||
|
||
.. table::
|
||
:widths: auto
|
||
|
||
+-------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`ensure_control_visible<class_ScrollContainer_method_ensure_control_visible>`\ (\ control\: :ref:`Control<class_Control>`\ ) |
|
||
+-------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`HScrollBar<class_HScrollBar>` | :ref:`get_h_scroll_bar<class_ScrollContainer_method_get_h_scroll_bar>`\ (\ ) |
|
||
+-------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`VScrollBar<class_VScrollBar>` | :ref:`get_v_scroll_bar<class_ScrollContainer_method_get_v_scroll_bar>`\ (\ ) |
|
||
+-------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+
|
||
|
||
.. rst-class:: classref-reftable-group
|
||
|
||
主题属性
|
||
--------
|
||
|
||
.. table::
|
||
:widths: auto
|
||
|
||
+-----------------------------------+--------------------------------------------------------------------------------------------+-------+
|
||
| :ref:`int<class_int>` | :ref:`scrollbar_h_separation<class_ScrollContainer_theme_constant_scrollbar_h_separation>` | ``0`` |
|
||
+-----------------------------------+--------------------------------------------------------------------------------------------+-------+
|
||
| :ref:`int<class_int>` | :ref:`scrollbar_v_separation<class_ScrollContainer_theme_constant_scrollbar_v_separation>` | ``0`` |
|
||
+-----------------------------------+--------------------------------------------------------------------------------------------+-------+
|
||
| :ref:`Texture2D<class_Texture2D>` | :ref:`scroll_hint_horizontal<class_ScrollContainer_theme_icon_scroll_hint_horizontal>` | |
|
||
+-----------------------------------+--------------------------------------------------------------------------------------------+-------+
|
||
| :ref:`Texture2D<class_Texture2D>` | :ref:`scroll_hint_vertical<class_ScrollContainer_theme_icon_scroll_hint_vertical>` | |
|
||
+-----------------------------------+--------------------------------------------------------------------------------------------+-------+
|
||
| :ref:`StyleBox<class_StyleBox>` | :ref:`focus<class_ScrollContainer_theme_style_focus>` | |
|
||
+-----------------------------------+--------------------------------------------------------------------------------------------+-------+
|
||
| :ref:`StyleBox<class_StyleBox>` | :ref:`panel<class_ScrollContainer_theme_style_panel>` | |
|
||
+-----------------------------------+--------------------------------------------------------------------------------------------+-------+
|
||
|
||
.. rst-class:: classref-section-separator
|
||
|
||
----
|
||
|
||
.. rst-class:: classref-descriptions-group
|
||
|
||
信号
|
||
----
|
||
|
||
.. _class_ScrollContainer_signal_scroll_ended:
|
||
|
||
.. rst-class:: classref-signal
|
||
|
||
**scroll_ended**\ (\ ) :ref:`🔗<class_ScrollContainer_signal_scroll_ended>`
|
||
|
||
当\ *通过触摸事件*\ 拖动可滚动区域而导致滚动停止时发出。当通过拖动滚动条滚动、使用鼠标滚轮滚动、或使用键盘/游戏手柄事件滚动时,\ *不会*\ 发出该信号。
|
||
|
||
\ **注意:**\ 该信号仅会在 Android、iOS、桌面、Web 平台上发出,在桌面/Web 平台上需要启用 :ref:`ProjectSettings.input_devices/pointing/emulate_touch_from_mouse<class_ProjectSettings_property_input_devices/pointing/emulate_touch_from_mouse>`\ 。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_ScrollContainer_signal_scroll_started:
|
||
|
||
.. rst-class:: classref-signal
|
||
|
||
**scroll_started**\ (\ ) :ref:`🔗<class_ScrollContainer_signal_scroll_started>`
|
||
|
||
当\ *通过触摸事件*\ 拖动可滚动区域而导致滚动开始时发出。当通过拖动滚动条滚动、使用鼠标滚轮滚动、或使用键盘/游戏手柄事件滚动时,\ *不*\ 会发出该信号。
|
||
|
||
\ **注意:**\ 该信号仅会在 Android、iOS、桌面、Web 平台上发出,在桌面/Web 平台上需要启用 :ref:`ProjectSettings.input_devices/pointing/emulate_touch_from_mouse<class_ProjectSettings_property_input_devices/pointing/emulate_touch_from_mouse>`\ 。
|
||
|
||
.. rst-class:: classref-section-separator
|
||
|
||
----
|
||
|
||
.. rst-class:: classref-descriptions-group
|
||
|
||
枚举
|
||
----
|
||
|
||
.. _enum_ScrollContainer_ScrollMode:
|
||
|
||
.. rst-class:: classref-enumeration
|
||
|
||
enum **ScrollMode**: :ref:`🔗<enum_ScrollContainer_ScrollMode>`
|
||
|
||
.. _class_ScrollContainer_constant_SCROLL_MODE_DISABLED:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`ScrollMode<enum_ScrollContainer_ScrollMode>` **SCROLL_MODE_DISABLED** = ``0``
|
||
|
||
禁用滚动,滚动条不可见。
|
||
|
||
.. _class_ScrollContainer_constant_SCROLL_MODE_AUTO:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`ScrollMode<enum_ScrollContainer_ScrollMode>` **SCROLL_MODE_AUTO** = ``1``
|
||
|
||
启用滚动,滚动条仅在需要时可见,即容器的内容比容器大时。
|
||
|
||
.. _class_ScrollContainer_constant_SCROLL_MODE_SHOW_ALWAYS:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`ScrollMode<enum_ScrollContainer_ScrollMode>` **SCROLL_MODE_SHOW_ALWAYS** = ``2``
|
||
|
||
启用滚动,滚动条始终可见。
|
||
|
||
.. _class_ScrollContainer_constant_SCROLL_MODE_SHOW_NEVER:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`ScrollMode<enum_ScrollContainer_ScrollMode>` **SCROLL_MODE_SHOW_NEVER** = ``3``
|
||
|
||
启用滚动,滚动条隐藏。
|
||
|
||
.. _class_ScrollContainer_constant_SCROLL_MODE_RESERVE:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`ScrollMode<enum_ScrollContainer_ScrollMode>` **SCROLL_MODE_RESERVE** = ``4``
|
||
|
||
:ref:`SCROLL_MODE_AUTO<class_ScrollContainer_constant_SCROLL_MODE_AUTO>` 和 :ref:`SCROLL_MODE_SHOW_ALWAYS<class_ScrollContainer_constant_SCROLL_MODE_SHOW_ALWAYS>` 的结合。仅在必要时显示滚动条,但是会按照滚动条始终显示来调整内容的大小。适合需要保证无论滚动条是否可见,内容大小都保持一致的场合。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _enum_ScrollContainer_ScrollHintMode:
|
||
|
||
.. rst-class:: classref-enumeration
|
||
|
||
enum **ScrollHintMode**: :ref:`🔗<enum_ScrollContainer_ScrollHintMode>`
|
||
|
||
.. _class_ScrollContainer_constant_SCROLL_HINT_MODE_DISABLED:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`ScrollHintMode<enum_ScrollContainer_ScrollHintMode>` **SCROLL_HINT_MODE_DISABLED** = ``0``
|
||
|
||
Scroll hints will never be shown.
|
||
|
||
.. _class_ScrollContainer_constant_SCROLL_HINT_MODE_ALL:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`ScrollHintMode<enum_ScrollContainer_ScrollHintMode>` **SCROLL_HINT_MODE_ALL** = ``1``
|
||
|
||
Scroll hints will be shown at the top and bottom (if vertical), or left and right (if horizontal).
|
||
|
||
.. _class_ScrollContainer_constant_SCROLL_HINT_MODE_TOP_AND_LEFT:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`ScrollHintMode<enum_ScrollContainer_ScrollHintMode>` **SCROLL_HINT_MODE_TOP_AND_LEFT** = ``2``
|
||
|
||
Scroll hints will be shown at the top (if vertical), or the left (if horizontal).
|
||
|
||
.. _class_ScrollContainer_constant_SCROLL_HINT_MODE_BOTTOM_AND_RIGHT:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`ScrollHintMode<enum_ScrollContainer_ScrollHintMode>` **SCROLL_HINT_MODE_BOTTOM_AND_RIGHT** = ``3``
|
||
|
||
Scroll hints will be shown at the bottom (if horizontal), or the right (if horizontal).
|
||
|
||
.. rst-class:: classref-section-separator
|
||
|
||
----
|
||
|
||
.. rst-class:: classref-descriptions-group
|
||
|
||
属性说明
|
||
--------
|
||
|
||
.. _class_ScrollContainer_property_draw_focus_border:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`bool<class_bool>` **draw_focus_border** = ``false`` :ref:`🔗<class_ScrollContainer_property_draw_focus_border>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_draw_focus_border**\ (\ value\: :ref:`bool<class_bool>`\ )
|
||
- :ref:`bool<class_bool>` **get_draw_focus_border**\ (\ )
|
||
|
||
如果为 ``true``\ ,则当 ScrollContainer 或其子节点获得焦点时会绘制 :ref:`focus<class_ScrollContainer_theme_style_focus>`\ 。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_ScrollContainer_property_follow_focus:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`bool<class_bool>` **follow_focus** = ``false`` :ref:`🔗<class_ScrollContainer_property_follow_focus>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_follow_focus**\ (\ value\: :ref:`bool<class_bool>`\ )
|
||
- :ref:`bool<class_bool>` **is_following_focus**\ (\ )
|
||
|
||
如果为 ``true``\ ,则 ScrollContainer 将自动滚动到获得焦点的子项(包括间接子项)以确保它们完全可见。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_ScrollContainer_property_horizontal_scroll_mode:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`ScrollMode<enum_ScrollContainer_ScrollMode>` **horizontal_scroll_mode** = ``1`` :ref:`🔗<class_ScrollContainer_property_horizontal_scroll_mode>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_horizontal_scroll_mode**\ (\ value\: :ref:`ScrollMode<enum_ScrollContainer_ScrollMode>`\ )
|
||
- :ref:`ScrollMode<enum_ScrollContainer_ScrollMode>` **get_horizontal_scroll_mode**\ (\ )
|
||
|
||
控制水平滚动条是否可用、应该何时可见。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_ScrollContainer_property_scroll_deadzone:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`int<class_int>` **scroll_deadzone** = ``0`` :ref:`🔗<class_ScrollContainer_property_scroll_deadzone>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_deadzone**\ (\ value\: :ref:`int<class_int>`\ )
|
||
- :ref:`int<class_int>` **get_deadzone**\ (\ )
|
||
|
||
触摸滚动的死区。较低的死区使滚动更加敏感。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_ScrollContainer_property_scroll_hint_mode:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`ScrollHintMode<enum_ScrollContainer_ScrollHintMode>` **scroll_hint_mode** = ``0`` :ref:`🔗<class_ScrollContainer_property_scroll_hint_mode>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_scroll_hint_mode**\ (\ value\: :ref:`ScrollHintMode<enum_ScrollContainer_ScrollHintMode>`\ )
|
||
- :ref:`ScrollHintMode<enum_ScrollContainer_ScrollHintMode>` **get_scroll_hint_mode**\ (\ )
|
||
|
||
The way which scroll hints (indicators that show that the content can still be scrolled in a certain direction) will be shown.
|
||
|
||
\ **Note:** Hints won't be shown if the content can be scrolled both vertically and horizontally.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_ScrollContainer_property_scroll_horizontal:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`int<class_int>` **scroll_horizontal** = ``0`` :ref:`🔗<class_ScrollContainer_property_scroll_horizontal>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_h_scroll**\ (\ value\: :ref:`int<class_int>`\ )
|
||
- :ref:`int<class_int>` **get_h_scroll**\ (\ )
|
||
|
||
当前的水平滚动值。
|
||
|
||
\ **注意:**\ 如果在 :ref:`Node._ready()<class_Node_private_method__ready>` 函数或更早的函数中设置该值,则需要用 :ref:`Object.set_deferred()<class_Object_method_set_deferred>` 包装,因为滚动条的 :ref:`Range.max_value<class_Range_property_max_value>` 此时尚未初始化。
|
||
|
||
::
|
||
|
||
func _ready():
|
||
set_deferred("scroll_horizontal", 600)
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_ScrollContainer_property_scroll_horizontal_custom_step:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`float<class_float>` **scroll_horizontal_custom_step** = ``-1.0`` :ref:`🔗<class_ScrollContainer_property_scroll_horizontal_custom_step>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_horizontal_custom_step**\ (\ value\: :ref:`float<class_float>`\ )
|
||
- :ref:`float<class_float>` **get_horizontal_custom_step**\ (\ )
|
||
|
||
覆盖点击内部滚动条的水平增减按钮或 :ref:`ScrollBar<class_ScrollBar>` 处于聚焦状态下使用方向键时使用的 :ref:`ScrollBar.custom_step<class_ScrollBar_property_custom_step>`\ 。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_ScrollContainer_property_scroll_vertical:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`int<class_int>` **scroll_vertical** = ``0`` :ref:`🔗<class_ScrollContainer_property_scroll_vertical>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_v_scroll**\ (\ value\: :ref:`int<class_int>`\ )
|
||
- :ref:`int<class_int>` **get_v_scroll**\ (\ )
|
||
|
||
当前的垂直滚动值。
|
||
|
||
\ **注意:**\ 与 :ref:`scroll_horizontal<class_ScrollContainer_property_scroll_horizontal>` 一样,最初设置时需要进行延迟。
|
||
|
||
::
|
||
|
||
func _ready():
|
||
set_deferred("scroll_vertical", 600)
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_ScrollContainer_property_scroll_vertical_custom_step:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`float<class_float>` **scroll_vertical_custom_step** = ``-1.0`` :ref:`🔗<class_ScrollContainer_property_scroll_vertical_custom_step>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_vertical_custom_step**\ (\ value\: :ref:`float<class_float>`\ )
|
||
- :ref:`float<class_float>` **get_vertical_custom_step**\ (\ )
|
||
|
||
覆盖点击内部滚动条的垂直增减按钮或 :ref:`ScrollBar<class_ScrollBar>` 处于聚焦状态下使用方向键时使用的 :ref:`ScrollBar.custom_step<class_ScrollBar_property_custom_step>`\ 。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_ScrollContainer_property_tile_scroll_hint:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`bool<class_bool>` **tile_scroll_hint** = ``false`` :ref:`🔗<class_ScrollContainer_property_tile_scroll_hint>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_tile_scroll_hint**\ (\ value\: :ref:`bool<class_bool>`\ )
|
||
- :ref:`bool<class_bool>` **is_scroll_hint_tiled**\ (\ )
|
||
|
||
If ``true``, the scroll hint texture will be tiled instead of stretched. See :ref:`scroll_hint_mode<class_ScrollContainer_property_scroll_hint_mode>`.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_ScrollContainer_property_vertical_scroll_mode:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`ScrollMode<enum_ScrollContainer_ScrollMode>` **vertical_scroll_mode** = ``1`` :ref:`🔗<class_ScrollContainer_property_vertical_scroll_mode>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_vertical_scroll_mode**\ (\ value\: :ref:`ScrollMode<enum_ScrollContainer_ScrollMode>`\ )
|
||
- :ref:`ScrollMode<enum_ScrollContainer_ScrollMode>` **get_vertical_scroll_mode**\ (\ )
|
||
|
||
控制垂直滚动条是否可用、应该何时可见。
|
||
|
||
.. rst-class:: classref-section-separator
|
||
|
||
----
|
||
|
||
.. rst-class:: classref-descriptions-group
|
||
|
||
方法说明
|
||
--------
|
||
|
||
.. _class_ScrollContainer_method_ensure_control_visible:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **ensure_control_visible**\ (\ control\: :ref:`Control<class_Control>`\ ) :ref:`🔗<class_ScrollContainer_method_ensure_control_visible>`
|
||
|
||
确保给定的 ``control`` 控件可见(必须是 ScrollContainer 的直接或间接子节点)。会被 :ref:`follow_focus<class_ScrollContainer_property_follow_focus>` 使用。
|
||
|
||
\ **注意:**\ 这不适用于在同一帧内刚刚添加的节点。如果想滚动到一个新添加的子节点,就必须使用 :ref:`SceneTree.process_frame<class_SceneTree_signal_process_frame>` 等待至下一帧:
|
||
|
||
::
|
||
|
||
add_child(child_node)
|
||
await get_tree().process_frame
|
||
ensure_control_visible(child_node)
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_ScrollContainer_method_get_h_scroll_bar:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`HScrollBar<class_HScrollBar>` **get_h_scroll_bar**\ (\ ) :ref:`🔗<class_ScrollContainer_method_get_h_scroll_bar>`
|
||
|
||
返回该 **ScrollContainer** 的水平滚动条 :ref:`HScrollBar<class_HScrollBar>`\ 。
|
||
|
||
\ **警告:**\ 这是一个必要的内部节点,移除和释放它可能会导致崩溃。如果你想禁用或隐藏滚动条,可以使用 :ref:`horizontal_scroll_mode<class_ScrollContainer_property_horizontal_scroll_mode>`\ 。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_ScrollContainer_method_get_v_scroll_bar:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`VScrollBar<class_VScrollBar>` **get_v_scroll_bar**\ (\ ) :ref:`🔗<class_ScrollContainer_method_get_v_scroll_bar>`
|
||
|
||
返回该 **ScrollContainer** 的垂直滚动条 :ref:`VScrollBar<class_VScrollBar>`\ 。
|
||
|
||
\ **警告:**\ 这是一个必要的内部节点,移除和释放它可能会导致崩溃。如果你想禁用或隐藏滚动条,可以使用 :ref:`vertical_scroll_mode<class_ScrollContainer_property_vertical_scroll_mode>`\ 。
|
||
|
||
.. rst-class:: classref-section-separator
|
||
|
||
----
|
||
|
||
.. rst-class:: classref-descriptions-group
|
||
|
||
主题属性说明
|
||
------------
|
||
|
||
.. _class_ScrollContainer_theme_constant_scrollbar_h_separation:
|
||
|
||
.. rst-class:: classref-themeproperty
|
||
|
||
:ref:`int<class_int>` **scrollbar_h_separation** = ``0`` :ref:`🔗<class_ScrollContainer_theme_constant_scrollbar_h_separation>`
|
||
|
||
The space between the ScrollContainer's vertical scroll bar and its content, in pixels. No space will be added when the content's minimum size is larger than the ScrollContainer's size.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_ScrollContainer_theme_constant_scrollbar_v_separation:
|
||
|
||
.. rst-class:: classref-themeproperty
|
||
|
||
:ref:`int<class_int>` **scrollbar_v_separation** = ``0`` :ref:`🔗<class_ScrollContainer_theme_constant_scrollbar_v_separation>`
|
||
|
||
The space between the ScrollContainer's horizontal scroll bar and its content, in pixels. No space will be added when the content's minimum size is larger than the ScrollContainer's size.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_ScrollContainer_theme_icon_scroll_hint_horizontal:
|
||
|
||
.. rst-class:: classref-themeproperty
|
||
|
||
:ref:`Texture2D<class_Texture2D>` **scroll_hint_horizontal** :ref:`🔗<class_ScrollContainer_theme_icon_scroll_hint_horizontal>`
|
||
|
||
The indicator that will be shown when the content can still be scrolled horizontally. See :ref:`scroll_hint_mode<class_ScrollContainer_property_scroll_hint_mode>`.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_ScrollContainer_theme_icon_scroll_hint_vertical:
|
||
|
||
.. rst-class:: classref-themeproperty
|
||
|
||
:ref:`Texture2D<class_Texture2D>` **scroll_hint_vertical** :ref:`🔗<class_ScrollContainer_theme_icon_scroll_hint_vertical>`
|
||
|
||
The indicator that will be shown when the content can still be scrolled vertically. See :ref:`scroll_hint_mode<class_ScrollContainer_property_scroll_hint_mode>`.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_ScrollContainer_theme_style_focus:
|
||
|
||
.. rst-class:: classref-themeproperty
|
||
|
||
:ref:`StyleBox<class_StyleBox>` **focus** :ref:`🔗<class_ScrollContainer_theme_style_focus>`
|
||
|
||
**ScrollContainer** 的聚焦边框 :ref:`StyleBox<class_StyleBox>`\ 。仅在 :ref:`draw_focus_border<class_ScrollContainer_property_draw_focus_border>` 为 ``true`` 时使用。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_ScrollContainer_theme_style_panel:
|
||
|
||
.. rst-class:: classref-themeproperty
|
||
|
||
:ref:`StyleBox<class_StyleBox>` **panel** :ref:`🔗<class_ScrollContainer_theme_style_panel>`
|
||
|
||
**ScrollContainer** 的背景 :ref:`StyleBox<class_StyleBox>`\ 。
|
||
|
||
.. |virtual| replace:: :abbr:`virtual (本方法通常需要用户覆盖才能生效。)`
|
||
.. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
|
||
.. |const| replace:: :abbr:`const (本方法无副作用,不会修改该实例的任何成员变量。)`
|
||
.. |vararg| replace:: :abbr:`vararg (本方法除了能接受在此处描述的参数外,还能够继续接受任意数量的参数。)`
|
||
.. |constructor| replace:: :abbr:`constructor (本方法用于构造某个类型。)`
|
||
.. |static| replace:: :abbr:`static (调用本方法无需实例,可直接使用类名进行调用。)`
|
||
.. |operator| replace:: :abbr:`operator (本方法描述的是使用本类型作为左操作数的有效运算符。)`
|
||
.. |bitfield| replace:: :abbr:`BitField (这个值是由下列位标志构成位掩码的整数。)`
|
||
.. |void| replace:: :abbr:`void (无返回值。)`
|