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

# TControlScrollBar.ScrollHandler

Handler for scroll bar movement messages.

## Declaration

Source position: forms.pp line 127

`protected procedure TControlScrollBar.ScrollHandler(`
`var Message: TLMScroll`
`);`

## Arguments

`Message` |  | Control message examined in the method.

## Description

ScrollHandler is a method used to ensure that the control message in Message is applied to the Position property for the scroll bar. ScrollHandler uses the ScrollCode member from the TLMScroll instance to determine the actions needed in the method. It handles the following ScrollCode values:

SB_LINEUP
  Decreases Position by the value in Increment.
SB_LINEDOWN
  Increases Position by the value in Increment.
SB_PAGEUP
  Decreases Position by the value in Page.
SB_PAGEDOWN
  Increases Position by the value in Page.
SB_THUMBPOSITION
  Sets Position to the value in the Pos member in Message.
SB_THUMBTRACK
  Sets Position to the value in the Pos member in Message when Tracking is enabled. No actions are performed when Tracking is set to False.
SB_TOP
  Sets Position to 0 (zero).
SB_BOTTOM
  Sets Position to the value in the Range property.

No actions are performed in the method if Message has any other value in its ScrollCode member. No actions are performed in the method at design-time.

ScrollHandler ensures the new value for the Position property is in the range 0..Range. Calls InvalidateScrollInfo to force scroll bar information to be re-initialized. Calls SetPosition to apply the new value for the Position property and scrolls the associated TScrollingWinControl accordingly. Sets the Result member in Message to 1 to indicate the control message was handled in the method.

ScrollHandler is called when the WMHScroll or WMVScroll methods in the associated TScrollingWinControl instance are used to handle scroll messages.

## See also

TControlScrollBar.Increment |  | Number of pixels the display area is scrolled for scroll bar or mouse wheel movements.
TControlScrollBar.Page |  | Number of pixels needed for a page on the associated control.
TControlScrollBar.Position |  | Position of the scroll bar slider in the range 0..Range-Page.
TControlScrollBar.Range |  | The size of the logical display area on the associated control for the scroll bar orientation.
TScrollingWinControl.WMHScroll |  | Delegates scroll messages to the handler for the horizontal scroll bar.
TScrollingWinControl.WMVScroll |  | Delegates scroll messages to the handler for the vertical scroll bar.