[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'Forms' (#lcl)

# TScrollBox

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Implements a windowed control with scroll bars.

## Declaration

Source position: forms.pp line 214

`type TScrollBox = class(TScrollingWinControl)`
`protected`
`class procedure WSRegisterClass; override;` |  | Registers this component class with the current WidgetSet.
`procedure SetParentBackground(); override;` |  | Sets the value for the ParentBackground property.
`procedure CMParentColorChanged(); message;` |  | Handles the CM_PARENTCOLORCHANGED message for the control.
`procedure Loaded; override;` |  | Performs actions when a component has been loaded during LCL component streaming.
`procedure UpdateParentColorChange;` |  | Updates ControlStyle flags to set the opacity for the control.
`public`
`constructor Create(); override;` |  | Constructor for the class instance.
`published`
`property Align: TAlign;` |  | Specifies the placement of the control on its Parent control.
`property Anchors: TAnchors;` |  | The set of anchor definitions for this control.
`property AutoSize: Boolean;` |  | Allows automatic adjustment of the size for the control, according to its content.
`property AutoScroll: Boolean;` |  | Indicates whether scroll bars are automatically displayed or hidden when needed.
`property BorderSpacing: TControlBorderSpacing;` |  | Determines the inner and outer border spacing for this control.
`property BiDiMode: TBiDiMode;` |  | Indicates whether text controls use in bi-directional reading.
`property BorderStyle: TBorderStyle;` |  | Line style used to draw the border around the control.
`property ChildSizing: TControlChildSizing;` |  | Provides a grid (table) layout for the children of this control.
`property ClientHeight: Integer;` |  | The height for the client area on the control.
`property ClientWidth: Integer;` |  | The width of the client area for the control.
`property Constraints: TSizeConstraints;` |  | Contains the minimum and maximum Width and Height for the control.
`property DockSite: Boolean;` |  | Allows controls to be drag-and-dock-ed into this control.
`property DragCursor: TCursor;` |  | The cursor shape shown during a drag operation.
`property DragKind: TDragKind;` |  | Indicates the action performed for a drag operation: drag-and-drop or drag-and-dock.
`property DragMode: TDragMode;` |  | Determines how a drag operation is started for the control.
`property Enabled: Boolean;` |  | Determines whether the control responds to mouse or keyboard input.
`property Color: TColor;` |  | The background color for the control.
`property Font: TFont;` |  | The font to be used for text display in this control.
`property ParentBackground: Boolean;` |  | Indicates if the control uses the background from its Parent control.
`property ParentBiDiMode: Boolean;` |  | Indicates whether the BiDiMode settings in the Parent control are used.
`property ParentColor: Boolean;` |  | Use the Color from the Parent control, when enabled.
`property ParentFont: Boolean;` |  | Indicates if the Font from the Parent control is used in the control.
`property ParentShowHint: Boolean;` |  | If True, the value of ShowHint for the control will be the same as the one from the Parent. Default is True.
`property PopupMenu: TPopupMenu;` |  | A context-sensitive menu that pops up when the right mouse button is clicked over this control.
`property ShowHint: Boolean;` |  | Enables Hint display for the control.
`property TabOrder: TTabOrder;` |  | Indicates the navigation order for the control when the user presses the Tab or Shift+Tab key.
`property TabStop: Boolean;` |  | Allows the user to navigate to / from the control by pressing the Tab or Shift+Tab keys.
`property Visible: Boolean;` |  | Allows the control, and all of its children, to be displayed or hidden.
`property OnClick: TNotifyEvent;` |  | Notification handler for mouse clicks.
`property OnConstrainedResize: TConstrainedResizeEvent;` |  | This handler can supply specific Constraints (size limits), when the control is resized.
`property OnDblClick: TNotifyEvent;` |  | Event handler signalled when a mouse double click occurs in the control.
`property OnDockDrop: TDockDropEvent;` |  | Event handler signalled for the drop of a control to be docked.
`property OnDockOver: TDockOverEvent;` |  | Event handler signalled when a control is moved over a docksite; determines whether the drop event is accepted or rejected.
`property OnDragDrop: TDragDropEvent;` |  | Event handler signalled when an object is dropped onto the control.
`property OnDragOver: TDragOverEvent;` |  | Event handler signalled when a control is dragged over the control instance.
`property OnEndDock: TEndDragEvent;` |  | Event handler signalled for the end of a drag-dock operation.
`property OnEndDrag: TEndDragEvent;` |  | Event handler signalled for the end of a drag-drop operation.
`property OnEnter: TNotifyEvent;` |  | Event handler signalled when the control receives focus.
`property OnExit: TNotifyEvent;` |  | Event handler signalled when the control loses focus.
`property OnGetSiteInfo: TGetSiteInfoEvent;` |  | Provides information about the DockSite for the control.
`property OnMouseDown: TMouseEvent;` |  | Event handler signalled when a mouse down event is handled for the control.
`property OnMouseEnter: TNotifyEvent;` |  | Event handler signalled when the mouse pointer has entered the control.
`property OnMouseLeave: TNotifyEvent;` |  | Event handler signalled when the mouse pointer has left the control.
`property OnMouseMove: TMouseMoveEvent;` |  | Event handler signalled when the mouse pointer is moved in the control.
`property OnMouseUp: TMouseEvent;` |  | Event handler signalled when a mouse up event is handled for the control.
`property OnMouseWheel: TMouseWheelEvent;` |  | Event handler for mouse wheel turned.
`property OnMouseWheelDown: TMouseWheelUpDownEvent;` |  | Event handler signalled for a downward movement of the mouse wheel.
`property OnMouseWheelUp: TMouseWheelUpDownEvent;` |  | Event handler signalled for an upward movement of the mouse wheel.
`property OnMouseWheelHorz: TMouseWheelEvent;` |  | Event handler signalled for a horizontal movement of the mouse wheel.
`property OnMouseWheelLeft: TMouseWheelUpDownEvent;` |  | Event handler signalled for a leftward movement of the mouse wheel.
`property OnMouseWheelRight: TMouseWheelUpDownEvent;` |  | Event handler signalled for a rightward movement of the mouse wheel.
`property OnResize: TNotifyEvent;` |  | Notification handler for a resize of the control.
`property OnStartDock: TStartDockEvent;` |  | Event handler for the start of a docking operation.
`property OnStartDrag: TStartDragEvent;` |  | Event handler signalled for the start of a dragging operation.
`property OnUnDock: TUnDockEvent;` |  | Event handler signalled before a control is undocked from its DockSite.
`property OnPaint: TNotifyEvent;` |  | Event handler signalled to paint the control.
`end;`

## Inheritance

`TScrollBox` |  | Implements a windowed control with scroll bars.
`TScrollingWinControl` |  | Implements a windowed control with scroll bars.
`TCustomControl` |  | The base class for windowed controls which paint themselves.
`TWinControl` |  | Implements a windowed control which can contain other child controls.
`TControl` |  | The base class for visible controls.
`TLCLComponent` |  | The base class for LCL components which have an associated widget.
`TComponent`
?
`TObject`

## Description

TScrollBox is a TScrollingWinControl descendant that implements a windowed control with scroll bars. It uses the logical and physical display areas introduced in the ancestor class, and allows a scrollable area to be displayed on a form or panel. The logical (or virtual) client area represents the dimensions needed for the child Controls added to the class instance. When the logical display area is larger than the visible area for the control, scroll bars allow the content to be moved into the visible area for the control.

TScrollBox sets the visibility for properties inherited from the ancestor class. TScrollBox includes an overridden constructor which sets the default values for properties in the class instance.

Child Controls can be added to the class instance at design-time, or at run-time by setting the scroll box as the Parent for a control.

The AutoScroll property indicates whether the scroll bars are automatically displayed (or hidden) as needed when the control is resized, or when child Controls are updated. This includes setting the page, range, and visibility for the scroll bars. Use the HorzScrollBar and VertScrollBar properties to access scroll bar page, range, and visibility when AutoScroll is not enabled.

An example application using TScrollBox is located in the examples/imgviewer directory.

## See also

TScrollingWinControl |  | Implements a windowed control with scroll bars.