Skip to content

ScrollContainer

Eduard Gushchin edited this page Jul 1, 2026 · 3 revisions

Home | API by Category | Complete API Index | API Compatibility

Field Value
Full name Electron2D.ScrollContainer
Namespace Electron2D
Kind class
Category UI and Text

Overview

Clips and scrolls direct child controls inside a viewport-sized rectangle.

Syntax

public class Electron2D.ScrollContainer : Electron2D.Container

Godot 4.7 C# profile compatibility

Profile: Electron2D 0.1.0 2D
Status: Supported / Parity verified
Out of profile: no
Godot reference: ScrollContainer

Scrollable clipped UI container with programmatic offsets, axis modes and descendant reveal helper.

Remarks

ScrollContainer stores programmatic scroll offsets and offsets visible child controls by those values. It does not create public scrollbar nodes in the 0.1.0 Preview runtime.

Thread Safety

This type is not synchronized. Create and mutate it on the main scene thread.

Since

This type is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Container
  • Electron2D.ScrollMode

Members

Member Kind Summary
DrawFocusBorder Property Gets or sets whether a focus border should be drawn by future widget renderers.
FollowFocus Property Gets or sets whether focused descendant controls should be revealed automatically.
HorizontalScrollMode Property Gets or sets the horizontal scroll mode.
ScrollDeadzone Property Gets or sets the deadzone used by future drag-scroll handling.
ScrollHintMode Property Gets or sets the scroll hint mode.
ScrollHorizontal Property Gets or sets the horizontal scroll offset.
ScrollHorizontalByDefault Property Gets or sets whether horizontal scrolling is preferred by default.
ScrollHorizontalCustomStep Property Gets or sets the custom horizontal scroll step.
ScrollVertical Property Gets or sets the vertical scroll offset.
ScrollVerticalCustomStep Property Gets or sets the custom vertical scroll step.
TileScrollHint Property Gets or sets whether scroll hints should be tiled by future renderers.
VerticalScrollMode Property Gets or sets the vertical scroll mode.
Electron2D.ScrollContainer() Constructor Initializes a new instance of the Electron2D.ScrollContainer type.
EnsureControlVisible(Electron2D.Control) Method Scrolls until the specified descendant control is visible.

Member Details

DrawFocusBorder

Kind: Property

public System.Boolean DrawFocusBorder { get; set; }

Summary

Gets or sets whether a focus border should be drawn by future widget renderers.

Remarks

The preview runtime stores this UI policy value but does not render a built-in focus border yet.

Value

true to request a focus border; otherwise, false.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

FollowFocus

Kind: Property

public System.Boolean FollowFocus { get; set; }

Summary

Gets or sets whether focused descendant controls should be revealed automatically.

Remarks

Automatic focus following is stored for API compatibility. Manual reveal is available through Electron2D.ScrollContainer.EnsureControlVisible(Electron2D.Control).

Value

true to let future focus handling reveal focused descendants; otherwise, false.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.ScrollContainer.EnsureControlVisible(Electron2D.Control)

HorizontalScrollMode

Kind: Property

public Electron2D.ScrollMode HorizontalScrollMode { get; set; }

Summary

Gets or sets the horizontal scroll mode.

Remarks

Electron2D.ScrollMode.Disabled clamps Electron2D.ScrollContainer.ScrollHorizontal to zero during layout. Other values keep programmatic scrolling enabled.

Value

The current Electron2D.ScrollMode for the horizontal axis.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.ScrollContainer.VerticalScrollMode

ScrollDeadzone

Kind: Property

public System.Int32 ScrollDeadzone { get; set; }

Summary

Gets or sets the deadzone used by future drag-scroll handling.

Remarks

Drag-scroll input is outside this task. The value is validated and stored so higher-level controls can share the same public API.

Value

A non-negative number of pixels.

Exceptions

  • System.ArgumentOutOfRangeException: Thrown when the value is less than zero.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

ScrollHintMode

Kind: Property

public Electron2D.ScrollHintMode ScrollHintMode { get; set; }

Summary

Gets or sets the scroll hint mode.

Remarks

The value is stored for future visual hint rendering and does not change layout in the 0.1.0 Preview runtime.

Value

The current Electron2D.ScrollHintMode.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

ScrollHorizontal

Kind: Property

public System.Int32 ScrollHorizontal { get; set; }

Summary

Gets or sets the horizontal scroll offset.

Remarks

The value is clamped during layout according to content size and Electron2D.ScrollContainer.HorizontalScrollMode.

Value

The non-negative horizontal offset in pixels.

Exceptions

  • System.ArgumentOutOfRangeException: Thrown when the value is less than zero.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.ScrollContainer.ScrollVertical

ScrollHorizontalByDefault

Kind: Property

public System.Boolean ScrollHorizontalByDefault { get; set; }

Summary

Gets or sets whether horizontal scrolling is preferred by default.

Remarks

The value is stored for input policy and does not affect layout.

Value

true to prefer horizontal scroll gestures; otherwise, false.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

ScrollHorizontalCustomStep

Kind: Property

public System.Single ScrollHorizontalCustomStep { get; set; }

Summary

Gets or sets the custom horizontal scroll step.

Remarks

The preview runtime stores the step for future input handling.

Value

A positive finite step value, or a negative value to use the default.

Exceptions

  • System.ArgumentOutOfRangeException: Thrown when the value is zero or not finite.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

ScrollVertical

Kind: Property

public System.Int32 ScrollVertical { get; set; }

Summary

Gets or sets the vertical scroll offset.

Remarks

The value is clamped during layout according to content size and Electron2D.ScrollContainer.VerticalScrollMode.

Value

The non-negative vertical offset in pixels.

Exceptions

  • System.ArgumentOutOfRangeException: Thrown when the value is less than zero.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.ScrollContainer.ScrollHorizontal

ScrollVerticalCustomStep

Kind: Property

public System.Single ScrollVerticalCustomStep { get; set; }

Summary

Gets or sets the custom vertical scroll step.

Remarks

The preview runtime stores the step for future input handling.

Value

A positive finite step value, or a negative value to use the default.

Exceptions

  • System.ArgumentOutOfRangeException: Thrown when the value is zero or not finite.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

TileScrollHint

Kind: Property

public System.Boolean TileScrollHint { get; set; }

Summary

Gets or sets whether scroll hints should be tiled by future renderers.

Remarks

The value is stored for future visual hint rendering.

Value

true to request tiled hints; otherwise, false.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

VerticalScrollMode

Kind: Property

public Electron2D.ScrollMode VerticalScrollMode { get; set; }

Summary

Gets or sets the vertical scroll mode.

Remarks

Electron2D.ScrollMode.Disabled clamps Electron2D.ScrollContainer.ScrollVertical to zero during layout. Other values keep programmatic scrolling enabled.

Value

The current Electron2D.ScrollMode for the vertical axis.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.ScrollContainer.HorizontalScrollMode

Electron2D.ScrollContainer()

Kind: Constructor

public Electron2D.ScrollContainer()

Summary

Initializes a new instance of the Electron2D.ScrollContainer type.

Remarks

The new scroll container enables Electron2D.Control.ClipContents so pointer hit-testing is clipped to the viewport rectangle by default.

Thread Safety

This constructor is not synchronized. Call it on the main scene thread.

Since

This constructor is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Control.ClipContents

EnsureControlVisible(Electron2D.Control)

Kind: Method

public System.Void EnsureControlVisible(Electron2D.Control)(Electron2D.Control control)

Summary

Scrolls until the specified descendant control is visible.

Remarks

The method adjusts Electron2D.ScrollContainer.ScrollHorizontal and Electron2D.ScrollContainer.ScrollVertical so the descendant rectangle fits inside this container's current Electron2D.Control.Size when possible.

Parameters

  • control: The descendant control that should be made visible inside this scroll container.

Exceptions

  • System.ArgumentNullException: Thrown when control is null.
  • System.InvalidOperationException: Thrown when control is not a descendant of this scroll container.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.ScrollContainer.ScrollHorizontal
  • Electron2D.ScrollContainer.ScrollVertical

Clone this wiki locally