Class TCastleScrollView

Unit

Declaration

type TCastleScrollView = class(TCastleUserInterface)

Description

Children added to ScrollArea can be scrolled vertically. We automatically show a scrollbar, and handle various scrolling inputs to be functional on both desktops and mobile (we handle scrolling by keys, mouse wheel, dragging by scrollbar, dragging the whole area - see EnableDragging).

Hierarchy

Overview

Fields

Public nested const DefaultKeyScrollSpeed = 200.0;
Public nested const DefaultWheelScrollSpeed = 20.0;

Methods

Protected function ScrollMin: Single;
Protected function ScrollMax: Single;
Public constructor Create(AOwner: TComponent); override;
Public destructor Destroy; override;
Public procedure RenderOverChildren; override;
Public function Press(const Event: TInputPressRelease): boolean; override;
Public function Release(const Event: TInputPressRelease): boolean; override;
Public function PreviewPress(const Event: TInputPressRelease): boolean; override;
Public function Motion(const Event: TInputMotion): boolean; override;
Public procedure Update(const SecondsPassed: Single; var HandleInput: boolean); override;

Properties

Protected property Scroll: Single read FScroll write SetScroll;
Protected property ScrollbarVisible: boolean read FScrollbarVisible;
Public property TintScrollBarInactive: TCastleColor read FTintScrollBarInactive write FTintScrollBarInactive;
Published property ClipChildren default true;
Published property ScrollArea: TInternalCastleScrollArea read FScrollArea;
Published property KeyScrollSpeed: Single read FKeyScrollSpeed write FKeyScrollSpeed default DefaultKeyScrollSpeed;
Published property WheelScrollSpeed: Single read FWheelScrollSpeed write FWheelScrollSpeed default DefaultWheelScrollSpeed;
Published property ScrollBarWidth: Single read FScrollBarWidth write FScrollBarWidth default 0;
Published property EnableDragging: boolean read FEnableDragging write FEnableDragging default false;
Published property TintScrollBarInactivePersistent: TCastleColorPersistent read FTintScrollBarInactivePersistent;

Description

Fields

Public nested const DefaultKeyScrollSpeed = 200.0;
 
Public nested const DefaultWheelScrollSpeed = 20.0;
 

Methods

Protected function ScrollMin: Single;

Min and max sensible values for Scroll.

Protected function ScrollMax: Single;
 
Public constructor Create(AOwner: TComponent); override;
 
Public destructor Destroy; override;
 
Public procedure RenderOverChildren; override;
 
Public function Press(const Event: TInputPressRelease): boolean; override;
 
Public function Release(const Event: TInputPressRelease): boolean; override;
 
Public function PreviewPress(const Event: TInputPressRelease): boolean; override;
 
Public function Motion(const Event: TInputMotion): boolean; override;
 
Public procedure Update(const SecondsPassed: Single; var HandleInput: boolean); override;
 

Properties

Protected property Scroll: Single read FScroll write SetScroll;

How many pixels do we scroll. This corresponds to ScrollArea vertical anchor, so it's in unscaled pixels. Kept as a float, to allow smooth time-based changes. Note that setting it always clamps the value to a sensible range.

Protected property ScrollbarVisible: boolean read FScrollbarVisible;
 
Public property TintScrollBarInactive: TCastleColor read FTintScrollBarInactive write FTintScrollBarInactive;

Color and alpha tint to use when scrollbar is not used. May have some alpha, which makes scrollbar "make itself more opaque", and thus noticeable, when you start dragging. By default it's opaque white, which means that no tint is shown.

Published property ClipChildren default true;

Scroll view rendering makes sense only when ClipChildren is True.

Published property ScrollArea: TInternalCastleScrollArea read FScrollArea;

Children you add here will be scrolled. To have a useful scrolling area:

  • Add some children to ScrollArea,

  • Set proper size of the ScrollArea (you can set an explicit size, or use TCastleUserInterface.AutoSizeToChildren),

  • Leave the ScrollArea anchors as default: ScrollArea should be anchored to the top-left corner of the parent.

Published property KeyScrollSpeed: Single read FKeyScrollSpeed write FKeyScrollSpeed default DefaultKeyScrollSpeed;

Speed of scrolling by keys, in pixels (before UI scaling) per second.

Published property WheelScrollSpeed: Single read FWheelScrollSpeed write FWheelScrollSpeed default DefaultWheelScrollSpeed;

Speed of scrolling by mouse wheel, in pixels (before UI scaling) per event.

Published property ScrollBarWidth: Single read FScrollBarWidth write FScrollBarWidth default 0;

Width of the scroll bar. Value of 0 means to use global default in Theme.ScrollBarWidth.

Published property EnableDragging: boolean read FEnableDragging write FEnableDragging default false;

Enable scrolling by dragging anywhere in the scroll area. This is usually suitable for mobile devices. Note that this doesn't affect the dragging directly by the scrollbar, which is always enabled.

Published property TintScrollBarInactivePersistent: TCastleColorPersistent read FTintScrollBarInactivePersistent;

TintScrollBarInactive that can be visually edited in Castle Game Engine Editor, Lazarus and Delphi. Normal user code does not need to deal with this, instead read or write TintScrollBarInactive directly.

See also
TintScrollBarInactive
Color and alpha tint to use when scrollbar is not used.

Generated by PasDoc 0.15.0.