ScrollContainer

Inherits: Container < Control < CanvasItem < Node < Object

Category: Core

Brief Description

A helper node for displaying scrollable elements (e.g. lists).

Member Variables

  • int scroll_horizontal - The current horizontal scroll value.
  • bool scroll_horizontal_enabled - If true, enables horizontal scrolling.
  • int scroll_vertical - The current horizontal scroll value.
  • bool scroll_vertical_enabled - If true, enables vertical scrolling.

Description

A ScrollContainer node with a Control child and scrollbar child (HScrollbar, VScrollBar, or both) 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 minimum_size of the Control relative to the ScrollContainer. Works great with a Panel control. You can set EXPAND on children size flags, so they will upscale to ScrollContainer size if ScrollContainer size is bigger (scroll is invisible for chosen dimension).