Skip to main content
A newer version of this page is available. .

TcxCustomGridController.Scroll(TScrollBarKind,TScrollCode,Integer) Method

Scrolls the View contents.

Declaration

procedure Scroll(AScrollBarKind: TScrollBarKind; AScrollCode: TScrollCode; var AScrollPos: Integer); virtual;

Parameters

Name Type
AScrollBarKind TScrollBarKind
AScrollCode TScrollCode
AScrollPos Integer

Remarks

The Scroll method is called internally when a user scrolls the View contents using the keyboard or scrollbars. You can control the visibility of scrollbars in tabular and Card Views via the View’s OptionsView.ScrollBars property. Chart Views display a scrollbar only for paged diagrams. Refer to the description of the View’s OptionsView.CategoriesPerPage and Controller.ActiveDiagramSupportsPaging properties for details on paging contents of chart diagrams. A scrollbar is displayed along a category axis. The diagram type determines the scrollbar’s orientation.

You can use the Scroll method to perform scrolling programmatically horizontally or vertically. The direction of scrolling is specified by the AScrollBarKind parameter. If it is set to sbHorizontal, the scrolling is performed horizontally. The sbVertical value designates vertical scrolling.

The AScrollCode parameter indicates the type (amount) of scrolling. The Scroll method recognizes the following scroll codes: scLineUp, scLineDown, scPageUp, scPageDown, scPosition and scTrack.

Rather than apply the Scroll method with scPosition or scTrack codes to perform scrolling to a specific position, you should use the LeftPos and TopRecordIndex properties declared in TcxCustomGridController descendants for this purpose.

The following table describes four scroll codes you can use with the Scroll method.

Value

Meaning

scLineUp

Vertical scrolling

This has the same effect as clicking the top scroll arrow.

Horizontal scrolling

Scrolls the View to the left by a specific amount of pixels similar to clicking the left scroll button.

scLineDown

Vertical scrolling

This has the same effect as clicking the bottom scroll arrow.

Horizontal scrolling

Scrolls the View to the right by a specific amount of pixels similar to clicking the right scroll button.

scPageUp

This has the same effect as clicking the area above the thumb tab (when scrolling vertically) or to the left of it (when scrolling horizontally).

scPageDown

This has the same effect as clicking the area down to the thumb tab (when scrolling vertically) or to the right of it (when scrolling horizontally).

A Card View displays only one scrollbar. Its orientation is defined by the View’s LayoutDirection property. When calling the Scroll method for a Card View, the AScrollBarKind parameter is ignored and scrolling is applied to the scrollbar determined by LayoutDirection.

The AScrollPos parameter is used when the Scroll method is called internally. When using the scLineUp, scLineDown, scPageUp and scPageDown scroll codes, this parameter is ignored.

The following code simulates clicking the bottom scroll arrow of a scrollbar:

var
  A: Integer;
  AView: TcxCustomGridTableView;
//...
  AView := TcxCustomGridTableView(Grid.FocusedView);
  A := 0;
  AView.Controller.Scroll(sbVertical, scLineDown, A);
See Also