ContentsIndexPreviousNext

3.9.1 Creating a Paged List Box

To create a paged list box, you simply add the style word "PAGED" to the standard list box definition. Unlike some style attributes that can be applied to the list box after it's created, the paged property must be specified in the original definition that creates the list box. You cannot change this property after the list box is created. Other styles and properties associated with list boxes can be used normally. Note, however, that a paged list box will always be UNSORTED regardless of what you specify. Therefore, you must supply data to the paged list box in the sort-order that is needed.

The following Screen Section fragment shows how a typical paged list box might be declared. This declaration appears in the larger examples found later in this section, as well. This example illustrates the use of a paged list box to present records contained in a "keywords" file.

    78  lines-per-page  value 12.
    77  list-1-data     pic x(30).

01  list-1, list-box using list-1-data,
    line 3, column 10, size 30,
    lines lines-per-page,
    paged, 3-d,
    exception procedure is list-1-handler.

In the preceding example, the level 78 item lines-per-page defines the number of lines contained in the list box. In the sections that follow, this size is referred to as a page. The level 78 makes the examples that follow easier to read. Also, note the declaration of an EXCEPTION PROCEDURE for the list box. This is typical for paged list boxes that are defined in the Screen Section. The EXCEPTION PROCEDURE will handle requests from the list box when more data is needed.