Function | Package: cg | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 10.1 Unrevised from 10.0 to 10.1. 10.0 version

## scroll-section

Arguments: grid-widget grid-section scroll-pos

This function scrolls a grid-section programmatically. The arguments are:

- grid-widget is the grid that contains the section to be scrolled.
- grid-section is the `grid-row-section` or `grid-column-section` of `grid-widget` that is to be scrolled.
- scroll-pos is a non-negative integer indicating the position to which the section should be scrolled. For a `grid-row-section`, this is the number of pixels that will be scrolled off the top edge of the section, and for a `grid-column-section` it is the number of pixels that will be scrolled off the left edge.

  A scroll-pos of zero scrolls a section to its beginning, which will display the left end of the subsections of a column-section or the top end of the subsections of a row-section. scroll-pos may be specified as the value of `most-positive-fixnum` (or other large integer) to scroll the section exactly to its end (with the last subsection right-aligned with the end of the section), because a grid section is guaranteed not to scroll past either end of its contents.

To scroll a grid-row to the top of a `grid-row-section` or a `grid-column` to the left of a `grid-column-section`, pass the edge-position of the row or column to scroll-section.

The following example may be run when the "Employee Information" window still exists after running the "Employee Chart" example on the Examples tab of the Navigator dialog. This code will find that example grid and scroll its "main" column section programmatically. First the section will scroll to its beginning (with the "Full Time?" column left-aligned), then scroll explicitly to the "Inspect" column, and then scroll to the end of the section. This is done four times, waiting a second at each scroll position.

    (let* ((window (find-window :employee-chart))
           grid column-section inspect-column-position)
      (unless window
        (error "Couldn't find the Employee Information example window.  ~
                Run the Employee Chart example and try again."))
      (select-window window)
      (setq grid (find-component :employee-grid window))
      (setq column-section (column-section grid :worksheet))
      (setq inspect-column-position (edge-position
                                     (subsection column-section :inspect)))
      (dotimes (j 4)
        (scroll-section grid column-section 0)
        (sleep 1)
        (scroll-section grid column-section inspect-column-position)
        (sleep 1)
        (scroll-section grid column-section most-positive-fixnum)
        (sleep 1)))

See section-scrolled on how to be notified whenever a grid-section is scrolled either programmatically or interactively.

Copyright (c) 1998-2022, Franz Inc. Lafayette, CA., USA. All rights reserved.
This page was not revised from the 10.0 page.
Created 2019.8.20.

|  | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 10.1 Unrevised from 10.0 to 10.1. 10.0 version