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

# TScrollBar

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

TScrollBar - a control that allows the user to scroll the current page or document window by moving a slider

## Declaration

Source position: stdctrls.pp line 122

`type TScrollBar = class(TCustomScrollBar)`
`published`
`property Align;` |  | Used to align the control to the top, bottom, left or right of its client.
`property Anchors;` |  | The set of anchor definitions for this control
`property BidiMode;` |  | BiDiMode - enabling bi-directional writing
`property BorderSpacing;` |  | Determines the border spacing for this control
`property Constraints;` |  | Determine Constraints (max and min height and width) for this control
`property DragCursor;` |  | DragCursor - the style of cursor to be used during the Drag process
`property DragKind;` |  | DragKind - what sort of dragging? Drag or Dock
`property DragMode;` |  | DragMode - whether manual or automatic
`property Enabled;` |  | Whether the control is Enabled (read/write). If not, it usually appears 'greyed-out'
`property Kind;` |  | Kind of scroll bar - whether Horizontal or Vertical
`property LargeChange;` |  | LargeChange - the size of the step to be taken by the slider for a large change
`property Max;` |  | The maximum value (for bottom of the scroll bar or the right-most extent)
`property Min;` |  | The minimum value, for the top of the scroll bar or its left-most extent
`property PageSize;` |  | PageSize: the size of a page - typically used for LargeChange
`property ParentBidiMode;` |  | ParentBiDiMode - does the control follow the BiDiMode settings of its parent?
`property ParentShowHint;` |  | ParentShowHint - does the control adopt the same hinting behaviour as its parent? Default is true
`property PopupMenu;` |  | PopupMenu - a context-sensitive menu that pops up when the right mouse button is clicked over this control
`property Position;` |  | The Position of the scroller along the ScrollBar
`property ShowHint;` |  | Flag to determine: Is hint to be displayed for this control?
`property SmallChange;` |  | SmallChange - the size of the step to be taken by the scroller for a small change
`property TabOrder;` |  | The place this control occupies in the list of tabs
`property TabStop;` |  | Is the control in the sequence of controls accessed by successive presses of the Tab key?
`property Visible;` |  | Visible - can the control be seen?
`property OnChange;` |  | OnChange - Event handler for any change in position of the slider or other mouse movement or keyboard event associated with the scrollbar
`property OnContextPopup;` |  | Event handler to supply information when a context-sensitive pop-up menu is required
`property OnDragDrop;` |  | Event handler for the drop of a control onto this control.
`property OnDragOver;` |  | Event handler for the case when a control is dragged over another control
`property OnEndDrag;` |  | Event handler for the end of a dragging process
`property OnEnter;` |  | OnEnter - event handler for when the mouse enters the control, and the control receives focus
`property OnExit;` |  | OnExit - event handler for when the mouse leaves the control and it loses focus
`property OnKeyDown;` |  | OnKeyDown - event handler for instance when key is down while control has focus
`property OnKeyPress;` |  | OnKeyPress - event controller for a key being pressed while the control has focus. To properly handle national chars use UTF8KeyPress instead.
`property OnKeyUp;` |  | OnKeyUp - event handler for instance when a key is up (not pressed) while the control has focus
`property OnScroll;` |  | OnScroll - Handler for a scrolling event (by mouse, keyboard or program)
`property OnStartDrag;` |  | Event handler for start of dragging operation
`property OnUTF8KeyPress;` |  | UTF8KeyPress - event controller for a key being pressed while the control has focus.
`end;`

## Inheritance

`TScrollBar` |  | TScrollBar - a control that allows the user to scroll the current page or document window by moving a slider
`TCustomScrollBar` |  | TCustomScrollBar : the base class for TScrollBar
`TWinControl`
`TControl`
`TLCLComponent` |  | TLCLComponent - base class for LCL components
`TComponent,IUnknown,IInterfaceComponentReference`
`TPersistent`
`TObject`

## Description

TScrollBar - a control that allows the user to scroll the current page or document window by moving a slider

It appears as a long rectangular track or bar within which a smaller contrasting block or slider can move up and down (or from side to side in a horizontal ScrollBar)

It has small triangular indicators or pointers at each end. Typically, for a vertical ScrollBar the top indicator points up, and at the bottom there is a pair of pointers, one up and one down. Clicking with the mouse on one of the pointers moves the slider a small distance (SmallChange) in the specified direction, and the programmer's responsibility is to ensure that the page, image or document in which the ScrollBar is found will scroll by a corresponding small amount

Clicking with the mouse in the blank area of the scrollbar above or below the slider makes the slider move by a larger increment (LargeChange) and scrolls the contents of the window by a larger amount - several lines, a paragraph, half a page or anything up to a page (PageSize)

The slider can also be moved by clicking on it with the mouse, and holding down the button while moving the mouse. The slider follows the mouse until the button is released. If the mouse has a scrollwheel, the slider can be similarly moved by rotating the wheel. In each case, the contents of the window scroll by a corresponding amount

Scrolling of the window and movement of the slider can also be achieved by using the directional arrows or the Page Up/Page Down keys on the keyboard

The location of the slider along the track is held in the Position property, which reports where the mouse has placed it, or can alternatively be set to an arbitrary location by the program. If the mouse or arrow keys are used to move the cursor somewhere on the main window so as to make the display scroll (eg by moving beyond the top or bottom line in a text display) the scroll bar slider moves to indicate the corresponding location along the scroll bar

## See also

HowToUseStdCtrls |  | How to use StdCtrls, ComCtrls or ExtCtrls

The latest version of this document can be found at lazarus-ccr.sourceforge.net .