TCustomGrid.TrySmoothScrollBy function
Scrolls the grid origin by the specified relative amounts.
Declaration
function TrySmoothScrollBy(aColDelta: Integer; aRowDelta: Integer)
: BooleanArguments
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.
Modified in LCL version 4.0 to have protected visibility.
See also
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
