ContentsIndexPreviousNext

3.9 Paged List Boxes

The standard list box control provides a convenient way for a program to implement a look-up facility for a group of items. It is also tempting to extend this type of use into a method for locating records in a data file. Unfortunately, this doesn't work well when there are too many records in the file. The programmer runs into two main problems:

1. The standard list box has a limited capacity (64K bytes), usually less than 2000 items.

2. It takes too long to load the list box with the entire set of items.

Also, if the number of items is very large, the user may have a difficult time locating a particular item. There are two reasons for this:

1. The resolution of the scroll bar's slider is too coarse.

2. The search mechanism is too primitive (single-character match on the first byte of the record).

The paged list box is a variation of the standard list box that solves all of these problems. A paged list box works by managing only a limited number of records at a time. When it needs more records, it requests them from the controlling program. Paged list boxes are intended to be used in conjunction with a large, ordered data source, typically records stored in an indexed file.

Compared to a standard list box, a paged list box has the following advantages:

1. There are no capacity limitations. Since the paged list box stores only a small number of items at once, capacity is not an issue.

2. Load time is minimized. The list box displays as soon as it receives enough items to fill its visible portion.

3. There is an enhanced search facility. A paged list box can search for items based on full text strings instead of single characters. When the paged list box is active, the user can simply begin typing a string of text. A search box pops up, displaying the entered characters and the list box scrolls to the first entry that matches the string. You determine (with the SORT-ORDER property) whether the search is case-sensitive or not.

4. Memory requirements are minimal. Because it stores only a few items at once, a paged list box can be less of a drain on memory than a standard list box.

The primary disadvantage of a paged list box is that it's more complicated to program. Also, it's not well suited to handling unordered data.

The rest of this section details the basics of programming paged list boxes.

More:

3.9.1 Creating a Paged List Box

3.9.2 Adding Records to a Paged List Box

3.9.3 Other List Box Operations

3.9.4 Paged List Box Event Handling

3.9.5 Paged List Box Example