Inheritance #
- AudioServer
- CameraServer
- ClassDB
- DisplayServer
- EditorFileSystemDirectory
- EditorInterface
- EditorPaths
- EditorSelection
- EditorUndoRedoManager
- EditorVCSInterface
- Engine
- EngineDebugger
- FramebufferCacheRD
- GDExtensionManager
- Geometry2D
- Geometry3D
- IP
- Input
- InputMap
- JNISingleton
- JSONRPC
- JavaClassWrapper
- JavaScriptBridge
- MainLoop (1)
- Marshalls
- MovieWriter
- NativeMenu
- NavigationMeshGenerator
- NavigationServer2D
- NavigationServer3D
- Node (21)
- OS
- OpenXRExtensionWrapperExtension
- OpenXRInteractionProfileMetadata
- Performance
- PhysicsDirectBodyState2D (1)
- PhysicsDirectBodyState3D (1)
- PhysicsDirectSpaceState2D (1)
- PhysicsDirectSpaceState3D (1)
- PhysicsServer2D (1)
- PhysicsServer2DManager
- PhysicsServer3D (1)
- PhysicsServer3DManager
- PhysicsServer3DRendering
ServerHandler
- ProjectSettings
- RefCounted (121)
- RenderData (2)
- RenderSceneData (2)
- RenderingDevice
- RenderingServer
- ResourceLoader
- ResourceSaver
- ResourceUID
- ScriptLanguage (1)
- ShaderIncludeDB
- TextServerManager
- ThemeDB
- TileData
- Time
- TranslationServer
- TreeItem
- UndoRedo
- UniformSetCacheRD
- WorkerThreadPool
- XRServer
- XRVRS
- AnimationMixer (2)
- AudioStreamPlayer
- CanvasItem (2)
- CanvasLayer (1)
- EditorFileSystem
- EditorPlugin (1)
- EditorResourcePreview
- HTTPRequest
- InstancePlaceholder
- MissingNode
- MultiplayerSpawner
- MultiplayerSynchronizer
- NavigationAgent2D
- NavigationAgent3D
- Node3D (31)
- ResourcePreloader
- ShaderGlobalsOverride
- StatusIndicator
- Timer
- Viewport (2)
- WorldEnvironment
- BaseButton (3)
- ColorRect
- Container (13)
- GraphEdit
- ItemList
- Label
- LineEdit
- MenuBar
- NinePatchRect
- Panel
- Range (6)
- ReferenceRect
- RichTextLabel
- Separator (2)
- TabBar
- TextEdit (1)
- TextureRect
- Tree
- VideoStreamPlayer
- AspectRatioContainer
- BoxContainer (2)
- CenterContainer
- EditorProperty
- FlowContainer (2)
- GraphElement (2)
- GridContainer
- MarginContainer
- PanelContainer (2)
- ScrollContainer (1)
- SplitContainer (2)
- SubViewportContainer
- TabContainer
Table of contents
-
var clip_contents: bool = true -
var draw_focus_border: bool = false -
var follow_focus: bool = false -
var horizontal_scroll_mode = SCROLL_MODE_AUTO -
var scroll_deadzone: int = 0 -
var scroll_horizontal: int = 0 -
var scroll_horizontal_custom_step: float = -1.0 -
var scroll_vertical: int = 0 -
var scroll_vertical_custom_step: float = -1.0 -
var vertical_scroll_mode = SCROLL_MODE_AUTO -
func ensure_control_visible(control: Control) -> void -
func get_h_scroll_bar() -> HScrollBar -
func get_v_scroll_bar() -> VScrollBar -
const SCROLL_MODE_DISABLED = 0 enum ScrollMode -
const SCROLL_MODE_AUTO = 1 enum ScrollMode -
const SCROLL_MODE_SHOW_ALWAYS = 2 enum ScrollMode -
const SCROLL_MODE_SHOW_NEVER = 3 enum ScrollMode -
const SCROLL_MODE_RESERVE = 4 enum ScrollMode -
enum ScrollMode -
signal scroll_ended() -
signal scroll_started() -
self["theme_override_styles/focus"] = style as StyleBox -
self["theme_override_styles/panel"] = style as StyleBox
ScrollContainer #
is_instantiable, Node, core, not_builtin_classes
A container used to provide scrollbars to a child control when needed.
A container used to provide a child control with scrollbars when needed. 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 Control.custom_minimum_size of the Control relative to the ScrollContainer.
Members #
var clip_contents: bool = true#
var draw_focus_border: bool = false#
If true, focus is drawn when the ScrollContainer or one of its descendant nodes is focused.
var follow_focus: bool = false#
If true, the ScrollContainer will automatically scroll to focused children (including indirect children) to make sure they are fully visible.
var horizontal_scroll_mode = SCROLL_MODE_AUTO#
Controls whether horizontal scrollbar can be used and when it should be visible. See ScrollMode for options.
var scroll_deadzone: int = 0#
Deadzone for touch scrolling. Lower deadzone makes the scrolling more sensitive.
var scroll_horizontal: int = 0#
The current horizontal scroll value.
Note: If you are setting this value in the Node._ready function or earlier, it needs to be wrapped with Object.set_deferred, since scroll bar's Range.max_value is not initialized yet.
func _ready():
set_deferred("scroll_horizontal", 600)var scroll_horizontal_custom_step: float = -1.0#
Overrides the ScrollBar.custom_step used when clicking the internal scroll bar's horizontal increment and decrement buttons or when using arrow keys when the ScrollBar is focused.
var scroll_vertical: int = 0#
The current vertical scroll value.
Note: Setting it early needs to be deferred, just like in scroll_horizontal.
func _ready():
set_deferred("scroll_vertical", 600)var scroll_vertical_custom_step: float = -1.0#
Overrides the ScrollBar.custom_step used when clicking the internal scroll bar's vertical increment and decrement buttons or when using arrow keys when the ScrollBar is focused.
var vertical_scroll_mode = SCROLL_MODE_AUTO#
Controls whether vertical scrollbar can be used and when it should be visible. See ScrollMode for options.
Methods #
func ensure_control_visible(control: Control) -> void#
Ensures the given control is visible (must be a direct or indirect child of the ScrollContainer). Used by 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 SceneTree.process_frame:
add_child(child_node)
await get_tree().process_frame
ensure_control_visible(child_node)func get_h_scroll_bar() -> HScrollBar#
Returns the horizontal scrollbar 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 horizontal_scroll_mode.
func get_v_scroll_bar() -> VScrollBar#
Returns the vertical scrollbar 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 vertical_scroll_mode.
Annotations #
Constants #
const SCROLL_MODE_DISABLED = 0 enum ScrollMode#
Scrolling disabled, scrollbar will be invisible.
const SCROLL_MODE_AUTO = 1 enum ScrollMode#
Scrolling enabled, scrollbar will be visible only if necessary, i.e. container's content is bigger than the container.
const SCROLL_MODE_SHOW_ALWAYS = 2 enum ScrollMode#
Scrolling enabled, scrollbar will be always visible.
const SCROLL_MODE_SHOW_NEVER = 3 enum ScrollMode#
Scrolling enabled, scrollbar will be hidden.
const SCROLL_MODE_RESERVE = 4 enum ScrollMode#
Combines SCROLL_MODE_AUTO and SCROLL_MODE_SHOW_ALWAYS. The scrollbar is only visible if necessary, but the content size is adjusted as if it was always visible. It's useful for ensuring that content size stays the same regardless if the scrollbar is visible.
Constructors #
Enums #
ScrollMode#
enum ScrollMode {
SCROLL_MODE_DISABLED = 0,
SCROLL_MODE_AUTO = 1,
SCROLL_MODE_SHOW_ALWAYS = 2,
SCROLL_MODE_SHOW_NEVER = 3,
SCROLL_MODE_RESERVE = 4,
} Operators #
Signals #
signal scroll_ended()#
Emitted when scrolling stops when dragging the scrollable area with a touch event. This signal is not emitted when scrolling by dragging the scrollbar, scrolling with the mouse wheel or scrolling with keyboard/gamepad events.
Note: This signal is only emitted on Android or iOS, or on desktop/web platforms when ProjectSettings.input_devices/pointing/emulate_touch_from_mouse is enabled.
signal scroll_started()#
Emitted when scrolling starts when dragging the scrollable area with a touch event. This signal is not emitted when scrolling by dragging the scrollbar, scrolling with the mouse wheel or scrolling with keyboard/gamepad events.
Note: This signal is only emitted on Android or iOS, or on desktop/web platforms when ProjectSettings.input_devices/pointing/emulate_touch_from_mouse is enabled.
Theme Items #
self["theme_override_styles/focus"] = style as StyleBox#
The focus border StyleBox of the ScrollContainer. Only used if draw_focus_border is true.
self["theme_override_styles/panel"] = style as StyleBox#
The background StyleBox of the ScrollContainer.