reckfellENGINE

BoxContainer

A row or column distributing available space.

On this page
class BoxContainerReckfellSharpInherits Container

BoxContainer is horizontal by default and permits changing Vertical. HBoxContainer and VBoxContainer fix orientation: do not call SetVertical on them, even with their current value.

Children are placed sequentially. The separation theme constant supplies the gap. Fill fills an allocated rectangle; Expand participates in free-space allocation. StretchRatio is a relative weight rather than an exact final-width percentage. Minima, maxima and gaps also participate. Maximize has container-specific priority behavior.

Alignment places remaining space at Begin/Center/End; ReverseSort reverses placement without reordering tree children. Account for RTL: the beginning is not necessarily the left edge. AddSpacer creates an already attached expanding Control; begin refers to the child-list beginning rather than necessarily the visual left edge.

Working example.

Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.

Constructors1

BoxContainerConstructor
# BoxContainer
C#
public BoxContainer();

Creates a horizontal mutable BoxContainer. Use HBoxContainer/VBoxContainer for a fixed direction.

Properties3

AlignmentProperty
# Alignment
C#
public BoxContainer.AlignmentMode Alignment { get; set; }

Begin, Center or End placement of remaining free space, Begin by default. Does not change individual child flags; account for Expand and RTL.

ReverseSortProperty
# ReverseSort
C#
public bool ReverseSort { get; set; }

Reverse placement order, false by default. Does not reorder tree children or change the axis; RTL is handled separately.

VerticalProperty
# Vertical
C#
public bool Vertical { get; set; }

Base BoxContainer axis: false is a row, true a column. Setter is rejected on HBoxContainer/VBoxContainer, even when assigning the current value.

Methods7

AddSpacerControl
# AddSpacer
C#
public Control AddSpacer(bool begin);

Creates and attaches an expanding Control; begin inserts it first in the child list. It expands along the current axis. MouseFilter is Pass; no serialization Owner is assigned. The result already belongs to the hierarchy.

Parameters
NameTypeDefault
beginbool—
begin

true inserts at the child-list beginning, false at its end. Does not guarantee a visual left/right edge with ReverseSort/RTL.

Returns Control

Attached child Control. Its lifetime is tied to its parent; do not free it while needed for layout.

GetAlignmentBoxContainer.AlignmentMode
# GetAlignment
C#
public BoxContainer.AlignmentMode GetAlignment();

Begin, Center or End placement of remaining free space, Begin by default. Does not change individual child flags; account for Expand and RTL.

Returns BoxContainer.AlignmentMode

Current AlignmentMode, Begin by default.

IsReverseSortbool
# IsReverseSort
C#
public bool IsReverseSort();

Reverse placement order, false by default. Does not reorder tree children or change the axis; RTL is handled separately.

Returns bool

Current reverse-placement flag, false by default.

IsVerticalbool
# IsVertical
C#
public bool IsVertical();

Base BoxContainer axis: false is a row, true a column. Setter is rejected on HBoxContainer/VBoxContainer, even when assigning the current value.

Returns bool

Axis: false for HBox, true for VBox, current value for the base Box.

SetAlignmentvoid
# SetAlignment
C#
public void SetAlignment(BoxContainer.AlignmentMode alignment);

Begin, Center or End placement of remaining free space, Begin by default. Does not change individual child flags; account for Expand and RTL.

Parameters
NameTypeDefault
alignmentBoxContainer.AlignmentMode—
alignment

Begin, Center or End relative to the current axis direction.

SetReverseSortvoid
# SetReverseSort
C#
public void SetReverseSort(bool reverseSort);

Reverse placement order, false by default. Does not reorder tree children or change the axis; RTL is handled separately.

Parameters
NameTypeDefault
reverseSortbool—
reverseSort

true reverses placement while retaining tree order.

SetVerticalvoid
# SetVertical
C#
public void SetVertical(bool vertical);

Base BoxContainer axis: false is a row, true a column. Setter is rejected on HBoxContainer/VBoxContainer, even when assigning the current value.

Parameters
NameTypeDefault
verticalbool—
vertical

false for horizontal or true for vertical orientation on the base BoxContainer only.

BoxContainer.AlignmentMode

ValueDescription
Begin = 0

The child controls will be arranged at the beginning of the container, i.e. top if orientation is vertical, left if orientation is horizontal (right for RTL layout).

Center = 1

The child controls will be centered in the container.

End = 2

The child controls will be arranged at the end of the container, i.e. bottom if orientation is vertical, right if orientation is horizontal (left for RTL layout).

Theme properties

These are Theme resource keys, not C# properties. Use the matching Control GetTheme…() and AddTheme…Override() methods for each value type.

Key and typeDescription
separation
int

The space between the BoxContainer's elements, in pixels.

Default: 4
Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.