Skip to main content

TdxCustomSpreadSheet.OnScroll Event

Enables you to respond to scrolling the active worksheet.

Declaration

property OnScroll: TdxSpreadSheetScrollEvent read; write;

Remarks

This event is fired every time the first scrollable row and/or column changes due to worksheet scrolling by:

Use the Sender, AScrollBarKind, and AFirstScrollablePosition parameters to identify the Spreadsheet/Report Designer control instance that raised the OnScroll event, the scrolling direction and the row/column currently displayed at the beginning of the visible and scrollable worksheet area. Refer to the TdxSpreadSheetScrollEvent procedural type description for detailed information on these parameters.

Handling the OnScroll event is particularly useful if you need to limit the scrollable worksheet area horizontally and/or vertically. The following code example shows how to limit the horizontal scrolling so that the CW column (that is, whose zero-based index is 100) is always visible:

TMySpreadSheetForm.dxSpreadSheet1Scroll(Sender: TdxCustomSpreadSheet; AScrollBarKind: TScrollBarKind; AFirstScrollablePosition: Integer);
begin
  if AScrollBarKind = sbHorizontal then  // If the active worksheet is scrolled horizontally
    Sender.ActiveSheetAsTable.MakeVisibleColumn(100);  // Make sure that the CW column is visible
end;

Note

A column or row must wholly fit into the visible worksheet to be considered visible.

See Also