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

# TCustomGrid.TrySmoothScrollBy

Scrolls the grid origin by the specified relative amounts.

## Declaration

Source position: grids.pas line 1205

`protected function TCustomGrid.TrySmoothScrollBy(`
`aColDelta: Integer;`
`aRowDelta: Integer`
`):Boolean;`

## Arguments

`aColDelta` |  | Indicates the direction and number of pixels for a horizontal scroll request.
`aRowDelta` |  | Indicates the direction and number of pixels for a vertical scroll request.

## Function result

True on successful completion of the scroll operation.

## Description

TrySmoothScrollBy is an Integer function used to scroll the grid control by the specified horizontal and vertical amounts (Deltas). TrySmoothScrollBy ensures that the internal cache for the control is updated to reflect the visible area for the control after the scroll operation.

TrySmoothScrollBy is called from methods that handle scroll bar or the event handler for mouse wheel messages, and occurs when the user interacts with the the grid control. For example: WMHScroll, WMVScroll, and GridMouseWheel. In is not intended for use in end-user code - but it's not expressly forbidden either.

AColDelta and ARowDelta contain the number of pixels that the control content should be scrolled in the horizontal and vertical directions. Positive values indicate that the content should scroll towards the right or bottom of the control. Negative values indicate that the content should scroll towards the left or top of the control.

No actions are performed in the method when both AColDelta and ARowDelta are set to 0 (zero).

TrySmoothScrollBy uses the coordinates for the visible cell at the top and left coordinates on the control for the scroll operation. It also uses values in ColWidths and RowHeights to determine when a cells become visible (or hidden) on the control canvas and in its cache. When goScrollKeepVisible has been included in Options, the selection on the control is extended to include the scrolled area. The ScrollBy method is called using the calculated X and Y offsets for the new top and left coordinates on the control.

The return value is True if the scroll operation was successfully completed in the method. The return value is False if the operation failed due to cell that is too tall or too wide for the requested scroll value(s). This can occur when goSmoothScroll is not included in the grid Options.

## Version info

Modified in LCL version 4.0 to have protected visibility.

## See also

TCustomGrid.ColWidths |  | Provides indexed access to the Width for a column in the grid.
TCustomGrid.GCache |  | Contains cached data about the visual layout and state for the grid control.
TCustomGrid.GetPxTopLeft |  | Gets a TPoint instance with the top and left coordinates for the first visible, non-fixed row in the grid control.
TCustomGrid.GetSmoothScroll |  | Gets the smooth scroll setting in the Options for the grid.
TCustomGrid.GridMouseWheel |  | Performs actions to apply a mouse wheel message to the grid control.
TCustomGrid.MoveNextSelectable |  | Moves to the next selectable cell in the specified direction.
TCustomGrid.Options |  | Contains the set of optional features and/or behaviors enabled for the grid control.
TCustomGrid.RowHeights |  | Provides indexed access to the height for each row in the grid.
TCustomGrid.ScrollBy |  | Scrolls the non-fixed area for the control by the specified delta values.
TCustomGrid.TopLeftChanged |  | Signals the OnTopLeftChanged event handler (when assigned) at run-time.
TCustomDrawGrid.GridMouseWheel |  | Performs actions when the mouse wheel is scrolled in the grid control.
TGridOption |  | Represents grid option values available for grid controls.