Anatomy of a Scroll Bar

Figure 25.1 shows the components of a window with a horizontal and vertical scroll bar under PCDOS or memory-mapped terminals. Under UNIX and VMS, the default characters differ.


Figure 25.1: Parts of a Scroll Bar

Each horizontal and vertical scroll bar has four components: 2 directional arrow characters, a page region, and a thumb. The arrows are standard indicators for the direction of the scroll bar.

The thumb's position in the page region indicates where the current visible page is within the entire viewing area. Thus, if the thumb is in the first position in the vertical scroll bar, the first page of the underlying contents is being displayed. If the thumb is in the last position in the vertical scroll bar, the last page of the underlying contents is being displayed.

The position of the thumb in the page region is based on the scroll bar's current value within the scroll bar range. Each scroll bar has an underlying scroll bar range that is specified when the scroll bar is defined. Ranges have a minimum value and maximum value. These values can be negative. For instance, you could have a range of 0 to 50 or -10 to +10.

The current value of the scroll bar represents the current page number within the range shown in the window. Since the thumb position is relative to the visible page in the window, the current value depends on the number of visible rows or columns in the window, as well as the range. Thus, if the current value is 0 in a range of 0 to 50, the first page of the underlying contents is being shown. However, if the current value is 0 in a range of
-10 to +10, the middle page of the underlying contents is being shown.

The system translates the current value within the range to a thumb position, which is the position in the page region that the thumb character is displayed. Numbering starts at 0. For example, suppose we have a page region composed of 40 characters. If the current value is -10 in a range of -10 to +10, then the thumb position is 0 (the first character in the page region). If the current value is 0, then the thumb position is 19 (the 20th character in the page region, which marks the mid-point of the page region).

In addition to the scroll bars, a corner character is drawn at the intersection of vertical and horizontal scroll bars. Note that this is not necessarily the corner character used by the current border type.

The cover size of a scroll bar is the number of character spaces in that side of the border minus the number of spaces taken by the page region. This number will be even since scroll bars are centered in the border. In the figure above, the cover size for the vertical scroll bar is 4 (two arrow characters and two corner characters). The cover size for the horizontal scroll bar is also 4.


Home Contents Previous Next