ScrollContainer

Inherits: Container < Control < CanvasItem < Node < Object

Category: Core

Brief Description

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

Member Functions

int get_h_scroll ( ) const
int get_v_scroll ( ) const
bool is_h_scroll_enabled ( ) const
bool is_v_scroll_enabled ( ) const
void set_enable_h_scroll ( bool enable )
void set_enable_v_scroll ( bool enable )
void set_h_scroll ( int val )
void set_v_scroll ( int val )

Member Variables

  • bool scroll_horizontal
  • bool scroll_vertical

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).

Member Function Description

  • int get_h_scroll ( ) const

Return current horizontal scroll value.

  • int get_v_scroll ( ) const

Return current vertical scroll value.

  • bool is_h_scroll_enabled ( ) const

Return true if horizontal scroll is allowed.

  • bool is_v_scroll_enabled ( ) const

Return true if vertical scroll is allowed.

  • void set_enable_h_scroll ( bool enable )

Set allows horizontal scroll.

  • void set_enable_v_scroll ( bool enable )

Set allows vertical scroll.

  • void set_h_scroll ( int val )

Set horizontal scroll value.

  • void set_v_scroll ( int val )

Set vertical scroll value.