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

# TControlScrollBar

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

Scroll bar type used in TScrollingWinControl.

## Declaration

Source position: forms.pp line 99

`type TControlScrollBar = class(TPersistent)`
`protected`
`FControl: TWinControl;` |  | The associated TScrollingWinControl instance.
`FPosition: Integer;` |  | Position of the scroll bar slider in the range 0..Range-Page.
`function ControlHandle; virtual;` |  | Gets the Handle for the associated TScrollingWinControl instance.
`function GetAutoScroll; virtual;` |  | Gets the AutoScroll state for the associated TScrollingWinControl control.
`function GetIncrement; virtual;` |  | Gets the value for the Increment property.
`function GetPage; virtual;` |  | Gets the value for the Page property.
`function GetPosition; virtual;` |  | Gets the value for the Position property.
`function GetRange; virtual;` |  | Gets the value for the Range property.
`function GetSize; virtual;` |  | Gets the value for the Size property.
`function GetSmooth; virtual;` |  | Gets the value for the Smooth property.
`function HandleAllocated; virtual;` |  | True when the associated TScrollingWinControl and its handle are valid.
`function IsRangeStored; virtual;` |  | Implements the storage specifier for the Range property.
`procedure ControlUpdateScrollBars; virtual;` |  | Forces the associated control to update its scroll bars.
`procedure InternalSetRange(); virtual;` |  | Validates and applies the specified Range and updates the scroll bars.
`procedure ScrollHandler();` |  | Handler for scroll bar movement messages.
`procedure SetIncrement(); virtual;` |  | Number of pixels the display area is scrolled for scroll bar or mouse wheel movements.
`procedure SetPage(); virtual;` |  | Number of pixels needed for a page on the associated control.
`procedure SetPosition();` |  | Position of the scroll bar slider in the range 0..Range-Page.
`procedure SetRange(); virtual;` |  | The size of the logical display area on the associated control for the scroll bar orientation.
`procedure SetSmooth(); virtual;` |  | Enables smooth scrolling, with automatic adjustment of Increment and Page.
`procedure SetTracking();` |  | Enables feedback when the slider is dragged.
`procedure SetVisible(); virtual;` |  | Hides the scroll bar when False (default True).
`procedure UpdateScrollBar; virtual;` |  | Updates the state and position for the scroll bar on the associated control.
`procedure InvalidateScrollInfo;` |  | Renders scroll information invalid for the control.
`function GetHorzScrollBar; virtual;` |  | Gets the horizontal scroll bar for the control.
`function GetVertScrollBar; virtual;` |  | Get the vertical scroll bar for the control.
`function ScrollBarShouldBeVisible; virtual;` |  | Determines whether a scroll bar is required.
`public`
`constructor Create();` |  | Constructor for the class instance.
`procedure Assign(); override;` |  | If Source is a TControlScrollBar, copies properties to itself, else performs inherited Assign.
`function IsScrollBarVisible; virtual;` |  | Determines if the scroll bar is visible using the state from the widgetset class.
`function ScrollPos; virtual;` |  | The Position for the scroll bar, or zero if not Visible.
`property Kind: TScrollBarKind; [r]` |  | The orientation for the scroll bar: horizontal or vertical.
`function GetOtherScrollBar;` |  | Gets the scroll bar with the opposite orientation (horz/vert) of the current instance.
`property Size: Integer; [rs]` |  | Height or width for the scroll bar.
`function ControlSize;` |  | Returns the size for the associated control.
`function ClientSize;` |  | Gets the size for the scroll bar based on the client area in the associated control.
`function ClientSizeWithBar;` |  | Calculates the size of the associated control when the scroll bar is Visible.
`function ClientSizeWithoutBar;` |  | Calculates the size of the associated control when the scroll bar is not Visible.
`published`
`property Increment: TScrollBarInc; [rw]` |  | Number of pixels the display area is scrolled for scroll bar or mouse wheel movements.
`property Page: TScrollBarInc; [rw]` |  | Number of pixels needed for a page on the associated control.
`property Smooth: Boolean; [rw]` |  | Enables smooth scrolling, with automatic adjustment of Increment and Page.
`property Position: Integer; [rw]` |  | Position of the scroll bar slider in the range 0..Range-Page.
`property Range: Integer; [rws]` |  | The size of the logical display area on the associated control for the scroll bar orientation.
`property Tracking: Boolean; [rw]` |  | Enables feedback when the slider is dragged.
`property Visible: Boolean; [rw]` |  | Hides the scroll bar when False (default True).
`end;`

## Inheritance

`TControlScrollBar` |  | Scroll bar type used in TScrollingWinControl.
`TPersistent`
?
`TObject`

## Description

Scrollable controls supply their own integrated scroll bars, one for horizontal and one for vertical scrolling. This class allows access to (one of) these integrated scroll bars.

A scrollable control has both a physical (visible) client size, and a logical (virtual) client size.

The Range property reflects the total virtual client size, in pixels.

The Page property corresponds to physical (visible) client size, in pixels, excluding the scroll bars. It also determines the size of the slider, relative to the total Range.

The Position property reflects the virtual origin of the visible client area, equivalent to the top coordinate of the slider. The Position can be changed by the user or by code.

Scroll bars usually appear only when Range is larger than Page, i.e. when the entire content cannot be shown in the visible area for a control. See the scroll bar properties in TScrollingWinControl for more details.

## See also

TScrollingWinControl |  | Implements a windowed control with scroll bars.
TScrollBox |  | Implements a windowed control with scroll bars.
TCustomForm |  | The base type for TForm classes.